Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google maps 如何在谷歌地图中为OFBiz使用KML文件?_Google Maps_Kml_Google Earth_Ofbiz - Fatal编程技术网

Google maps 如何在谷歌地图中为OFBiz使用KML文件?

Google maps 如何在谷歌地图中为OFBiz使用KML文件?,google-maps,kml,google-earth,ofbiz,Google Maps,Kml,Google Earth,Ofbiz,我试图在OFBiz框架中使用GoogleMaps中的KML文件作为web应用程序。我正在arraylist中输入坐标值。那么,我如何开始在谷歌地图中使用Kml文件 我在.ftl文件中插入了谷歌地图的代码 function initialize() { var map; var bounds = new google.maps.LatLngBounds(); var mapOptions = { mapTypeId: 'sat

我试图在OFBiz框架中使用GoogleMaps中的KML文件作为web应用程序。我正在arraylist中输入坐标值。那么,我如何开始在谷歌地图中使用Kml文件

我在.ftl文件中插入了谷歌地图的代码

function initialize() {
        var map;
        var bounds = new google.maps.LatLngBounds();
        var mapOptions = {
            mapTypeId: 'satellite'
        };

        // Display a map on the page
        map = new google.maps.Map(document.getElementById("map_canvas"), mapOptions);
        map.setTilt(45);

        // Multiple Markers
        var markers = [
            ['London Eye, London', 51.503454,-0.119562],
            ['Palace of Westminster, London', 51.499633,-0.124755]
        ];

        // Info Window Content
        var infoWindowContent = [
            ['<div class="info_content">' +
            '<h3>London Eye</h3>' +
            '<p>The London Eye is a giant Ferris wheel situated on the banks of the River Thames. The entire structure is 135 metres (443 ft) tall and the wheel has a diameter of 120 metres (394 ft).</p>' +        '</div>'],
            ['<div class="info_content">' +
            '<h3>Palace of Westminster</h3>' +
            '<p>The Palace of Westminster is the meeting place of the House of Commons and the House of Lords, the two houses of the Parliament of the United Kingdom. Commonly known as the Houses of Parliament after its tenants.</p>' +
            '</div>']
        ];

        // Display multiple markers on a map
        var infoWindow = new google.maps.InfoWindow(), marker, i;
        var infoWindow1 = [];

        for( i = 0; i < farmerCropList.length; i++ ) {
            var position = new google.maps.LatLng(farmerCropList[i].latitude, farmerCropList[i].longitude);
            bounds.extend(position);
            marker = new google.maps.Marker({
                position: position,
                map: map,
                title: farmerCropList[i].farmerCropId
            });

            infoWindow1[i] = new google.maps.InfoWindow({
                  content: '<div style="padding:5px;width:100%;height:auto;">' +
                                        '<div style="padding:5px;width:400px;font-size:16px;text-align:left">Farmer Name : '+(farmerCropList[i].firstName + farmerCropList[i].lastName)+'</div>'+
                                        '</div>'
              });



            var lastOpen = -1;
             google.maps.event.addListener(marker, 'click', (function(marker, i) {
                    if (lastOpen > -1) {
                        infoWindow1[lastOpen].close();
                    }
                    return function(){
                    infoWindow1[i].open(map, marker);
                    }
                    lastOpen = i;
            })(marker, i));


            map.fitBounds(bounds);
        }

        var boundsListener = google.maps.event.addListener((map), 'bounds_changed', function(event) {
            this.setZoom(15);
            google.maps.event.removeListener(boundsListener);
        });

        google.maps.event.addDomListener(window, 'load', initialize);

    }

您可以使用Kmlayer

看到这个谷歌开发者示例了吗


尝试在OFBiz中使用ftl。在这种格式中,您可以使用与JSP相同的样式:我在.ftl文件中使用了@ronnguyen来实现。这个问题来自您的Google API技能,而不是OFBiz。确保你包含了足够的库:你试图加载的KML文件是什么?我知道了!!!我包括kml层…它的工作很好。。。