小编Iva*_*era的帖子

如何在Google Maps API中使用邮政编码代替Lat和Lng

我想知道是否有办法使用zipcode而不是Lat和Lng,使用此代码段或使用地理编码请求.

    <script type="text/javascript">
        function initialize() {
            var latlng = new google.maps.LatLng(22.1482635,-100.9100755);
            // var latlang = new google.maps.zipcode(7845); <- Is there a way to do that?
            var myOptions = {
                zoom: 8,
                center: latlng,
                mapTypeId: google.maps.MapTypeId.ROADMAP
            };

            var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
            var marker = new google.maps.Marker({
                position: latlng,
                map: map,
                title:"zipcode"
            });

        }
    </script>
Run Code Online (Sandbox Code Playgroud)

maps zipcode google-maps

19
推荐指数
1
解决办法
3万
查看次数

标签 统计

google-maps ×1

maps ×1

zipcode ×1