SitePoint Sponsor

User Tag List

Results 1 to 10 of 10
  1. #1
    SitePoint Zealot
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Change data using Google Store Locator

    Hi i'm using the Google Store Locator tut to work on somthing I'd like to create. After downloading all the source code everything is fine yet when I try to change the data (medicare.csv) everything goes blank. I understand using excel to to changes on the csv file is a problem.

    All this leads me to think I'd be better off using the dynamic example where I can call the data from a mysql DB and upload from a CSV file no matter what IDE it came from?

    Has anyone used this and if so are there any good examples I can look at - i'm getting frustrated!
    Enjoy what you do, enjoy what you learn but above all ENJOY IT!
    stevanbarry.com

  2. #2
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,401
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Hi stephen,

    Are you able to share a couple of rows from your CSV file? Also, have you changed any of the other files? I've downloaded the medicare example and I'm just having a play around to see how it works.

  3. #3
    SitePoint Zealot
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello sir,

    I've only tried basic changes to the example - even changing the titles throws up problems. I changed Fcilty_nam to name in the csv and the
    Code:
    var store = new storeLocator.Store(row.uuid, position, features, {
          title: row.Fcilty_nam,
    but to no avail.

    I'll get working on an idea and post - prehaps for future amending a JSON - PHP/MySql route would be better?

    The other issue as well is the "Xcoord","Ycoord" - i'd rather use lat long that Google recognises. Not sure about this also?
    Enjoy what you do, enjoy what you learn but above all ENJOY IT!
    stevanbarry.com

  4. #4
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,401
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    Quote Originally Posted by stephen_ View Post
    The other issue as well is the "Xcoord","Ycoord" - i'd rather use lat long that Google recognises. Not sure about this also?
    The Xcoord and Ycoord are the longitude and latitude.. the order in the CSV is the reverse of the order that you get them from google maps. In fact that could be why your data points are not showing on the map, if they're in the wrong order.

  5. #5
    SitePoint Zealot
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm going to play around and i'll report back - ive also seen a plugin https://github.com/bjorn2404/jQuery-...Locator-Plugin that i'd like to take a look at as well.

    Thanks for the advice (as always)!
    Enjoy what you do, enjoy what you learn but above all ENJOY IT!
    stevanbarry.com

  6. #6
    SitePoint Zealot
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay i've realised that using excel to modify the csv file is not good. It removes the " marks and therefore changes the file structure. Thanks fretburner as well on the co-ords realised after geocoding my data.

    Anyone now of a good unbotrusive csv editor - dont want to use notepad++ and cant use excel.... Google spreadsheets?
    Enjoy what you do, enjoy what you learn but above all ENJOY IT!
    stevanbarry.com

  7. #7
    SitePoint Zealot
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay i'd really like to pull my data from a mysql DB. I've set up the DB using a similar structure as the medicare.csv file - http://storelocator.googlecode.com/git/examples/

    However I want to change the medicare-dynamic-ds.js file to allow a connection to my DB.

    I've also read that the example above uses deprecated mysql_ functions and should use a PDO method instead...... to say i'm confused is an understatement.
    Enjoy what you do, enjoy what you learn but above all ENJOY IT!
    stevanbarry.com

  8. #8
    SitePoint Zealot
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stephen_ View Post
    Okay i'd really like to pull my data from a mysql DB. I've set up the DB using a similar structure as the medicare.csv file - http://storelocator.googlecode.com/git/examples/

    However I want to change the medicare-dynamic-ds.js file to allow a connection to my DB.

    I've also read that the example above uses deprecated mysql_ functions and should use a PDO method instead...... to say i'm confused is an understatement.
    What I would like to do is amend the line in the medicare-dynamic-ds.js file to allow a connection to be made in mySQL DB.
    Enjoy what you do, enjoy what you learn but above all ENJOY IT!
    stevanbarry.com

  9. #9
    Community Advisor bronze trophy
    fretburner's Avatar
    Join Date
    Apr 2013
    Location
    Brazil
    Posts
    1,401
    Mentioned
    45 Post(s)
    Tagged
    12 Thread(s)
    You'll need to provide a URL where the JS can get the data in JSON format.. once you've got the data from your DB, you'd do something like this:
    PHP Code:
    header('Content-type: application/json');
    echo (
    $_GET['callback'].'('.json_encode($data).');'); 
    Did you manage to get it working using your custom CSV already?

  10. #10
    SitePoint Zealot
    Join Date
    May 2012
    Location
    N.Ireland
    Posts
    103
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers Fretburner I'll try this - yes the csv is now okay in part - noticed if i remove some fields then it messes up again. Think i getting there.
    Enjoy what you do, enjoy what you learn but above all ENJOY IT!
    stevanbarry.com


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •