开发者

postal code to google map

开发者 https://www.devze.com 2023-03-19 13:26 出处:网络
I am a newbie in google map. I learn from google map documentation but I don’t found anything about postal code to google map. I only have a postal code to get the google ma开发者_如何转开发p. If so

I am a newbie in google map. I learn from google map documentation but I don’t found anything about postal code to google map. I only have a postal code to get the google ma开发者_如何转开发p. If so can I get a map from postal code. I also find in google for tutorials for that but I don't found anything. If you have a useful code or tutorial, please help me.


You first need to get the latitude/longitude from address/postcode. There is a Google GeoCodeing API for getting longitude and lattitude from address and possibly post code. It got some usage limits though. Have a look

http://code.google.com/apis/maps/documentation/geocoding/

Once u get the long/lat u can then feed these into google mapping api

E.g. Using the following javascript api http://maps.google.com/maps/api/js?sensor=false

You can do

RenderMap(54.1109429427243, -3.197265625, 6, "resultsMapHome");

function RenderMap(lat, lng, zoomLevel, divName) {
    var position = new google.maps.LatLng(lat, lng);
    var options = {
        zoom: zoomLevel,
        center: position,
        mapTypeId: google.maps.MapTypeId.ROADMAP
    };
    map = new google.maps.Map(document.getElementById(divName), options);
    map.setCenter(position);
}

I can't format the script as I am typing from my iPhone. I will reformat it later when I get to work.


http://maps.google.com

Put in the post code, zoom in / out until you have the position you'd like the map on your own website. Then click the 'link' button to the right of the search bar (looks like a chain). This gives you the appropriate code to put that map into your website.

Is that what you wanted? I couldn't understand your English very well.

0

精彩评论

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