Note that there are some explanatory texts on larger screens.

plurals
  1. POGet the Latitude and Longitude from address
    text
    copied!<p>I am planning to use this following subroutine in asp.net web application to get the Latitude and Longitude from the given address (any address in the world). For an example, on saving vendor details, the system will show the map with exact Latitude and Longitude.</p> <p>We are planning to use google map in our web application. I believe I am using version 3 of google API which has a limit of 2500 requests per day.</p> <p>Could you please advise me if there is any other efficient way of getting the Latitude and Longitude from any world address? Also is there any API which has no request limits and can be used with google.</p> <p>Also do i need to sign up for google APIv3?</p> <p><strong>Code:</strong></p> <pre><code>Private Sub GetLatLongFromAddress(street As String, city As String, zipcode As String, state As String) Dim geocoderUri As String = String.Format("http://maps.googleapis.com/maps/api/geocode/xml?address={0},{1},{2},{3}&amp;sensor=false", street, city, zipcode, state) Dim geocoderXmlDoc As New XmlDocument() geocoderXmlDoc.Load(geocoderUri) Dim nsMgr As New XmlNamespaceManager(geocoderXmlDoc.NameTable) nsMgr.AddNamespace("geo", "http://www.w3.org/2003/01/geo/wgs84_pos#") Dim sLong As String = geocoderXmlDoc.DocumentElement.SelectSingleNode("//geometry/location/lat", nsMgr).InnerText Dim sLat As String = geocoderXmlDoc.DocumentElement.SelectSingleNode("//geometry/location/lng", nsMgr).InnerText txtLat.Text = sLat txtLon.Text = sLong End Sub </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload