开发者

creating google maps website - map city to latitude and longitude

is there a way where i can enter a city name and get the latitude and longitude for that location as i am trying to take a list of cities and dynamically populate a google maps webpage.

I have the idea of the code below but i dont have the Latitude or Longitude points.

        foreach (City city in cities)
        {
            markerString.AppendLine("       var point" + i + " = new GLatLng(" + city .Location.Latitude + "," + city .Location.Longitude + ");");
            markerString.AppendLine(开发者_如何学编程"       var marker" + i + " = new GMarker(point" + i + ");");
            markerString.AppendLine("       marker" + i + ".value = " + i + ";");
        }


Yes. This is known as geocoding.

Google's javascript geocoding API: http://code.google.com/apis/maps/documentation/services.html#Geocoding

HTTP API: http://code.google.com/apis/maps/documentation/geocoding/index.html

A C# library for geocoding: http://code.google.com/p/geocoding-net/ (uses either Google, Yahoo or Microsoft).


these are also good sites

http://itouchmap.com/latlong.html
http://www.opengeocoding.org/geocoding/geocod.html

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜