如何绘制动画openlayers线串路径?

时间:2015-08-12 09:05:22

标签: javascript xml openlayers gpx

我使用openlaers map api。我想在我的路径中显示动画路线,如http://jerusalem.com/map#!/tour/the_way_of_the_cross/location/abu_jaafar。怎么做?谢谢。

这是我的Java脚本,我从XML文件中获取数据。

<script type="text/javascript">                          
                var zoom=13

        var map; //complex object of type OpenLayers.Map

        function init() {
            map = new OpenLayers.Map ("map", {
                controls:[
                    new OpenLayers.Control.Navigation(),
                    new OpenLayers.Control.PanZoomBar(),
                    new OpenLayers.Control.LayerSwitcher(),
                    new OpenLayers.Control.Attribution()],
                maxExtent: new OpenLayers.Bounds(-20037508.34,-20037508.34,20037508.34,20037508.34),
                maxResolution: 156543.0399,
                numZoomLevels: 19,
                units: 'm',
                projection: new OpenLayers.Projection("EPSG:900913"),
                displayProjection: new OpenLayers.Projection("EPSG:4326")
            } );

            // Define the map layer
            // Here we use a predefined layer that will be kept up to date with URL changes
            layerMapnik = new OpenLayers.Layer.OSM.Mapnik("Mapnik");
            map.addLayer(layerMapnik);
            layerCycleMap = new OpenLayers.Layer.OSM.CycleMap("CycleMap");
            map.addLayer(layerCycleMap);
            layerMarkers = new OpenLayers.Layer.Markers("Markers");
            map.addLayer(layerMarkers);

        //   Add the Layer with the GPX Track
            var lgpx = new OpenLayers.Layer.Vector("Descrizione del layer", {
                strategies: [new OpenLayers.Strategy.Fixed()],
                protocol: new OpenLayers.Protocol.HTTP({
                    url: "c.php",
                    format: new OpenLayers.Format.GPX()
                }),
                style: {strokeColor: "blue", strokeWidth: 5, strokeOpacity: 0.5},

            projection: new OpenLayers.Projection("EPSG:4326")

            });



            map.addLayer(lgpx);

        }

    </script>

0 个答案:

没有答案
相关问题