Problem with google map & # 8594; google.maps.KmlLayer

I have a controller (address / Home / Test see below) that definitely responds to a request:

<?xml version="1.0" encoding="utf-8"?><kml xmlns="http://www.opengis.net/kml/2.2"><Placemark><name>Simple placemark</name><description>Attached to the ground. Intelligently places itself
           at the height of the underlying terrain.</description><Point><coordinates>-122.0822035425683,37.42228990140251,0</coordinates></Point></Placemark></kml>

This is similar to a feed that responds to a request (application / vnd.google-earth.kml + xml) to a receive request.

I am using this javascript:

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false&region=GB"></script>
    <script type="text/javascript" src="/Scripts/jquery-1.4.1.js"></script>


    <script type="text/javascript">

        $(document).ready(function() {
        var latlng = new google.maps.LatLng(37.42228990140251, -122.0822035425683);
            var options = {
                zoom: 17,
                center: latlng,
                mapTypeId: google.maps.MapTypeId.HYBRID
            };
            var map = new google.maps.Map(document.getElementById('map_canvas'), options);


            //alert(georssLayer);
            var georssLayer = new google.maps.KmlLayer('/Home/Test');

            georssLayer.setMap(map);
        });
    </script> 

A map is displayed, but nothing is -122.0822035425683,37.42228990140251.

Any ideas?

Perhaps I do not understand what KmlLayer does? I assume that it fulfills the request for receipt, and then overlays the card ...

Christian

+3
source share
1 answer

http://code.google.com/apis/maps/documentation/javascript/overlays.html :" API Google KML GeoRSS . KmlLayer, URL- KML GeoRSS. ' , ; , Google.

+7

Source: https://habr.com/ru/post/1759314/


All Articles