<google-map>想要显示带导航的楼层地图</google-map>

时间:2015-03-17 09:41:03

标签: google-maps google-maps-api-3

上传地板图对我来说很清楚,但我需要实现室内导航(意味着它在Android中显示室内地图中的用户当前位置(蓝点)和用户想要到达的目标路径)。我想知道印度是否支持室内Google导航。如果它受支持,那么如何实现它。 感谢

1 个答案:

答案 0 :(得分:0)

是的,印度支持它。事实上,您可以通过India访问22个城市的室内Google地图热门室内场所。

要在您的网站中实施地理位置(定位用户的位置),请使用以下代码:

<script src="http://www.google.com/jsapi?key=ABQIAAAAlJFc1lrstqhgTl3ZYo38bBQcfCcww1WgMTxEFsdaTsnOXOVOUhTplLhHcmgnaY0u87hQyd-n-kiOqQ"></script>
<script>
    (function () {
        google.load("maps", "2");
        google.setOnLoadCallback(function () {
            // Create map
            var map = new google.maps.Map2(document.getElementById("map")),
                markerText = "<h2>You are here</h2><p>Nice with geolocation, ain't it?</p>",
                markOutLocation = function (lat, long) {
                    var latLong = new google.maps.LatLng(lat, long),
                        marker = new google.maps.Marker(latLong);
                    map.setCenter(latLong, 13);
                    map.addOverlay(marker);
                    marker.openInfoWindow(markerText);
                    google.maps.Event.addListener(marker, "click", function () {
                        marker.openInfoWindow(markerText);
                    });
                };
                map.setUIToDefault();

            // Check for geolocation support    
            if (navigator.geolocation) {
                // Get current position
                navigator.geolocation.getCurrentPosition(function (position) {
                        // Success!
                        markOutLocation(position.coords.latitude, position.coords.longitude);
                    }, 
                    function () {
                        // Gelocation fallback: Defaults to Stockholm, Sweden
                        markerText = "<p>Please accept geolocation for me to be able to find you. <br>I've put you in Stockholm for now.</p>";
                        markOutLocation(59.3325215, 18.0643818);
                    }
                );
            }
            else {
                // No geolocation fallback: Defaults to Eeaster Island, Chile
                markerText = "<p>No location support. Try Easter Island for now. :-)</p>";
                markOutLocation(-27.121192, -109.366424);
            }
        }); 
    })();
</script>

希望这会有所帮助。