-2

On our app we're using the Google Maps Web API and I'm having trouble plotting the correct location when providing a link to the Google map. It often shows a raw lat/lng result with no with "Place" listing, or worse, it finds the wrong location when there are multiple Places in the same general location.

I see Google has APIs for all of this but I can't seem to figure out what I need to make this happen. I simply want to provide an accurate link. Our data is usually 100% correct and includes the location titles, address and coordinates (as selected on a map).

Our old code essentially generated a link like you see below. We used the location title and coordinates and manually generated a URL.

http://maps.google.com/maps/place/Poway+Express+Tire/@32.953278,-117.05744900000002,14z
jasonbarone
  • 172
  • 3
  • 17
  • Are you trying to search by address instead of geoposition? https://www.google.com/maps?q=Sydney+Harbour+Bridge,+Sydney+NSW – Byren Higgin Feb 11 '16 at 04:12
  • Unfortunately I've tried numerous methods and am coming up with issues. When I use a query like your example, the results are mixed. When I plot the coordinates into the link, the results are mixed and often innaccurate. I guess I'm wondering what best practice is to get a correct location. Is it possible to hit a Google API with a location and title and Google returns the **best** possible suggestion? – jasonbarone Feb 11 '16 at 04:16
  • Have you seen the [Embed API](https://developers.google.com/maps/documentation/embed/)? – geocodezip Feb 11 '16 at 04:21

1 Answers1

0

Here is the basic html format for google maps

https://www.google.com/maps/@yourlat,yourlon,15z

and the 'yourlat' or 'yourlon' might have a '-' negative sign if necessary.

There is google geocoder api either forward or reverse geo-coding can be done, but I've only used it with Java on andriod

geocoder = new Geocoder(this, Locale.ENGLISH);              
geocoder.getFromLocation(old_latitude, old_longitude, 1);  

The first line creates the object in java the .getFromLocation method get the first location for the given lat/lon.

Peter Birdsall
  • 3,159
  • 5
  • 31
  • 48
  • I ultimately just used the `?q` method and fed it the title, location and coordinates, although using that method before didn't really provide consistent results. Thanks for your help – jasonbarone Feb 12 '16 at 00:36