Google Maps API - Get Coordinates of address

前端 未结 4 1647
离开以前
离开以前 2020-11-30 16:27

I would like to convert addresses into long/lat.

Is there any way to do this without using JavaScript? Because in my case there is no need to display anythi

相关标签:
4条回答
  • 2020-11-30 16:41

    What you are looking for is called Geocoding.

    Google provides a Geocoding Web Service which should do what you're looking for. You will be able to do geocoding on your server.

    JSON Example:

    http://maps.google.com/maps/api/geocode/json?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA

    XML Example:

    http://maps.google.com/maps/api/geocode/xml?address=1600+Amphitheatre+Parkway,+Mountain+View,+CA


    Edit:

    Please note that this is now a deprecated method and you must provide your own Google API key to access this data.

    0 讨论(0)
  • 2020-11-30 16:50

    Althugh you asked for Google Maps API, I suggest an open source, working, legal, free and crowdsourced API by Open street maps

    https://nominatim.openstreetmap.org/search?q=Mumbai&format=json

    Here is the API documentation for reference.

    Edit: It looks like there are discrepancies occasionally, at least in terms of postal codes, when compared to the Google Maps API, and the latter seems to be more accurate. This was the case when validating addresses in Canada with the Canada Post search service, however, it might be true for other countries too.

    0 讨论(0)
  • 2020-11-30 16:51

    Geocoding through Javascript:
    https://developers.google.com/maps/documentation/javascript/geocoding

    0 讨论(0)
  • 2020-11-30 17:07

    A Nuget solved my problem:Geocoding.Google 4.0.0. Install it so not necessary to write extra classes etc.

    https://www.nuget.org/packages/Geocoding.Google/

    0 讨论(0)
提交回复
热议问题