Страница 1 из 1

Geoserver->GWC+OL+KML не отображает метки

Добавлено: 19 окт 2010, 03:17
dvd_xaker
не отображает метки
Код Test.html

Код: Выделить всё

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">   
<title>Test</title>
    <style type="text/css">
        #map {
            width: 100%;
            height: 80%;
            border: 1px solid black;
        }
        .olPopup p { margin:0px; font-size: .9em;}
        .olPopup h2 { font-size:1.2em; }
    </style>
    <script src="http://openlayers.org/api/OpenLayers.js"></script>
    <script type="text/javascript">
        var map, select;
		function init(){
OpenLayers.DOTS_PER_INCH = 90.71428571428572;
OpenLayers.Util.onImageLoadErrorColor = 'transparent';
        var map, select;
var mapOptions = {projection: new OpenLayers.Projection('EPSG:4326'),
maxExtent: new OpenLayers.Bounds(-180.0,-90.0,180.0,90.0),
units: "degrees",
controls: []
};
            map = new OpenLayers.Map('map',mapOptions);
map.addControl(new OpenLayers.Control.Navigation());
map.addControl(new OpenLayers.Control.PanZoomBar({position: new OpenLayers.Pixel(2, 15)}));
map.addControl(new OpenLayers.Control.Scale($('scale')));
map.addControl(new OpenLayers.Control.MousePosition({element: $('location')}));
            var wms = new OpenLayers.Layer.WMS("Test","http://localhost:8080/geoserver/gwc/service/wms",{layers: 'Test:layers', format: 'image/png8'});

            var sundials = new OpenLayers.Layer.Vector("KML", {
                projection: map.displayProjection,
                strategies: [new OpenLayers.Strategy.Fixed()],
                protocol: new OpenLayers.Protocol.HTTP({
                    url: "kml/test.kml",
                    format: new OpenLayers.Format.KML({
                        extractStyles: true,
                        extractAttributes: true
                    })
                })
            });
            
            map.addLayers([wms, sundials]);
            
            select = new OpenLayers.Control.SelectFeature(sundials);
            
            sundials.events.on({
                "featureselected": onFeatureSelect,
                "featureunselected": onFeatureUnselect
            });

            map.addControl(select);
            select.activate();
			map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.zoomToExtent(new OpenLayers.Bounds(35.22,52.19,35.34,52.30));
        }
        function onPopupClose(evt) {
            select.unselectAll();
        }
        function onFeatureSelect(event) {
            var feature = event.feature;
            var content = "<h2>"+feature.attributes.name + "</h2>" + feature.attributes.description;
            if (content.search("<script") != -1) {
                content = "Content contained Javascript! Escaped content below.<br />" + content.replace(/</g, "<");
            }
            popup = new OpenLayers.Popup.FramedCloud("chicken", 
                                     feature.geometry.getBounds().getCenterLonLat(),
                                     new OpenLayers.Size(100,100),
                                     content,
                                     null, true, onPopupClose);
            feature.popup = popup;
            map.addPopup(popup);
        }
        function onFeatureUnselect(event) {
            var feature = event.feature;
            if(feature.popup) {
                map.removePopup(feature.popup);
                feature.popup.destroy();
                delete feature.popup;
            }
        }
    </script>
  </head>
  <body onload="init()">
    <div id="map"></div>
  </body>
</html>
Код test.kml

Код: Выделить всё

<?xml version="1.0" encoding="UTF-8"?>
<kml xmlns="http://www.opengis.net/kml/2.2">
	<Document>
		<name>KML Samples</name>
		<open>1</open>
		<description>Layers 1</description>
		<Style id="globe">
			<IconStyle>
				<Icon>
					<href>http://maps.google.com/mapfiles/kml/pal3/icon19.png</href>
				</Icon>
			</IconStyle>
			<LineStyle>
				<width>2</width>
			</LineStyle>
		</Style>
		
			<Placemark>
				<name>Тестовая метка</name>
				<description>Тестовая инфа</description>
<Point>
<coordinates>35.2252,52.2351</coordinates>
</Point>
</Placemark>
	</Document>
</kml>
Не могу понять в чем ошибка.
Пробовал даже разные кодировки и kml созранять по разному)