Skip navigation
Currently Being Moderated

Longitude and latitude in a web app to generate a point on a google map

May 29, 2012 7:53 PM

Hi all,

 

Is it possible to have a longitude and latitude field in a web app and then have them generate a point on a google map?

 

Or would I need to also have address fields filled in the web app data to have a point on a google map?

 

Thanks!

 
Replies
  • mario_gudelj
    1,579 posts
    Oct 13, 2010
    Currently Being Moderated
    May 30, 2012 12:57 AM   in reply to MaryBlight

    In Google's tutorial they're not using the address - https://developers.google.com/maps/documentation/javascript/tutorial#H elloWorld

     

    You just need to replace the values in new google.maps.LatLng(-34.397, 150.644), with tags that render those.

     

    Cheers,

     

    -mario

     
    |
    Mark as:
  • mario_gudelj
    1,579 posts
    Oct 13, 2010
    Currently Being Moderated
    May 30, 2012 3:40 AM   in reply to MaryBlight

    Well, yes. To use BC you need an address. BC will geocode the address into lat and long and pass those values together with address to Google for plotting. Without address you can't use BC. But from your question I understood that you have lat and long and all you need to do is plot them on the map. You can easily do this by creating couple of custom fields for lat and long and plot them into JS snippet from that link I gave you.

     

    Cheers,

     

    -mario

     
    |
    Mark as:
  • mario_gudelj
    1,579 posts
    Oct 13, 2010
    Currently Being Moderated
    Jun 14, 2012 8:42 PM   in reply to MaryBlight

    Hi Mary,

     

    The only way to plot all the results on a single map is with {module_webappsresultsmap}. There's probably a way to do it with the custom JS, but I've never done it and wouldn't be able to tell you how it's done.

     

    -mario

     
    |
    Mark as:
  • mario_gudelj
    1,579 posts
    Oct 13, 2010
    Currently Being Moderated
    Jun 17, 2012 7:06 PM   in reply to MaryBlight

    Lat and Long values are geocoded from Country, State and Postcode/Zipcode values. You have to have all 3 fields present to get those values. If you're getting a zero for lat and long our database may not have the values you entered from state and zip or you've entered them incorrectly. Please note that the states must be abbreviations.

     

    Cheers,

     

    -mario

     
    |
    Mark as:
  • mario_gudelj
    1,579 posts
    Oct 13, 2010
    Currently Being Moderated
    Jun 18, 2012 11:50 PM   in reply to MaryBlight

    The way BC does this in V2 maps API is by sending the lat and long to google together with the address and then google plots it. Perhaps try googling that kind of functionality and see if you can some kind of solution.

     

    -m

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 23, 2012 6:50 AM   in reply to mario_gudelj

    Has anybody figured this out? I am developing a business directory and need the Google Map on each individual listing created with a web app. I have been able to get the map to show (using myLatlng = new google.maps.LatLng({tag_latitude},{tag_longitude}) but for some reason my map locations are way off. I'm thinking it has something to do with what's discussed above. Any help would be appreciated.

     

    Update: OK. I just did a GPS coordinate search and it looks also that the wrong GPS #'s are being used. What could cause this?

     

    Example address: 805 E. Main Street Salisbury MD 21804

    GPS coordinates returned in BC: 38.359332,-75.56931

    Correct GPS according to Google: 38.36683291257159, -75.58512069999995

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2012 1:08 AM   in reply to SproutCreatives

    I have updated the coordinates for the address "805 E. Main Street Salisbury MD 21804" - the correct coordinates should be showing up shortly. Please send me a PM if you ar ehaving trouble with other ZIP codes not plotting at the correct coordinates.

     
    |
    Mark as:
  • Liam Dilley
    4,040 posts
    Feb 28, 2012
    Currently Being Moderated
    Aug 6, 2012 1:43 AM   in reply to Mihai_Tica

    V2 was a bit buggy and TBH I found BC's implementation to be buggy.

    I Use googles V3 Api and store the map locations in data elements and run my maps function to read the web app item API.

    Works, lots of control,and can use the canvas / HTML based map version over the iFrame implementation.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 6, 2012 2:10 AM   in reply to Liam Dilley

    I do the same as Liam. Just works, every time :-)

     
    |
    Mark as:
  • Liam Dilley
    4,040 posts
    Feb 28, 2012
    Currently Being Moderated
    Aug 6, 2012 2:44 AM   in reply to Vincent-1

    Less hassle and more options, just really nice to use hey Vincent. V2 was always a bit flawed, why V3 came out very quickly and has stuck around since.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 12:24 PM   in reply to Liam Dilley

    Liam,

     

    How exactly did you get this to work? I am creating maps but the Lat/Long tags are not outputting at all. I am getting nothing.

     

    Here is the code that I am using to render the map:

     

    var mapOptions = {

              zoom: 12,

                          keyboardShortcuts: false,

      center: new google.maps.LatLng({tag_addresslatitude}, {tag_addresslongitude}),

                          disableDefaultUI: true,

                          draggable: false,

                          scrollwheel: false,

                          zoomControl: true,

                          zoomControlOptions: {

                                    style: google.maps.ZoomControlStyle.SMALL

                                  },

                          mapTypeControlOptions: {

                                    mapTypeIds: [google.maps.MapTypeId.ROADMAP, 'map_style']

                                  }

            };

     

     

    If I input actual values, the maps render correctly.

     

    Thanks.

     
    |
    Mark as:
  • Currently Being Moderated
    Aug 10, 2012 9:23 PM   in reply to jeremyccrane

    I solved the problem. Apparently the states must be entered as two-character abbreviations no the actual value (ie CA not California).

     

    - Jeremy

     
    |
    Mark as:
  • Liam Dilley
    4,040 posts
    Feb 28, 2012
    Currently Being Moderated
    Aug 10, 2012 10:33 PM   in reply to jeremyccrane

    Hey, Sorry did not reply sooner but yes. That is outlined in the documentation isnt it? I have always known that.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 10, 2012 8:42 PM   in reply to Liam Dilley

    Liam, how do you "store the map locations in data elements"? I'm having problems with the latitude/longitude returned from BC to be erroneous. I have many addresses located within a few city blocks and they're all coming in from BC as one latitude/longitude. Thanks in advance for any guidance you may have.

     
    |
    Mark as:
  • Liam Dilley
    4,040 posts
    Feb 28, 2012
    Currently Being Moderated
    Oct 10, 2012 8:43 PM   in reply to mrkos67

    <div data-yourparamatername="{tag_tagyouwanttouse}"></div>

     

    For example

    To validate the html this is only for HTML5 of course.

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 10, 2012 9:32 PM   in reply to Liam Dilley

    i guess what i'm looking for is more accurate latitude/longitudes, and something that would maintain within the db? what you've suggested is just a client side data field, right?

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 16, 2012 2:17 AM   in reply to mario_gudelj

    Hi Mario

    In Sweden we don't use state in our adress, just city. When I add a swedish adress in a webapp and using standard map-listing, map is centered west of africa, but the pointer is correct. When using UK address (whitout state) it center and works well.

     

    BUT - When using uk address in my custom-map I get values for {tag_addresslatitude} and {tag_addresslongitude} and it works fine, but when using a Swedish address I get zeros.

     

    Your collegue Mihai_Tica talked about update in a database to solve an address (see below).

     

    I havent found a solution my self.

     

    Test: Standard BC-function: bbq.se/t

    Test: Custom map in UK: bbq.se/karta

    Thanks!

    //J

     
    |
    Mark as:
  • mario_gudelj
    1,579 posts
    Oct 13, 2010
    Currently Being Moderated
    Oct 22, 2012 4:31 PM   in reply to Johan Holmberg

    Hi Johan,

     

    It's probably the case where the lat and long for Swedish addresses are resolving to 0,0 and are being plotted on 0 meridian and 0 parallel, off of the coast of Africa. Mihai has probably asked you for the addresses and lat and long values to populate our DB. You should get back to him and supply him with those details.

     

    Cheers,

     

    -m

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 23, 2012 12:34 AM   in reply to mario_gudelj

    Thank you for your reply. I'll check with Mihai.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (1)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points