On Sunday, May 2, 2010, Zuhex <gmd...@hotmail.com> wrote: > > hello > > I am new for Openlayer and GeoServer.I was created KML file from ArcGIS by > converted shapefile to KMZ. So I extracted KMZ file and then I got one image > and one KML file. I put them together into my KML folder. > Here this is my code > > ################################################## > > <script type="text/javascript"> > var map, select; > function init(){ > format = 'image/png'; > > var bounds = new OpenLayers.Bounds( > 745805.484, 1675119.129, > 748889.77, 1682234.497 > ); > var options = { > controls: [], > maxExtent: bounds, > maxResolution: 15, > projection: "EPSG:24047", > units: 'm', > numZoomLevels:5 > }; > map = new OpenLayers.Map('map', options); > > // setup tiled layer > tiled = new OpenLayers.Layer.WMS( > "Tiled", "http://localhost:8080/geoserver/wms", > { > layers: 'KhaoSomphot', > srs: 'EPSG:24047', > format: format, > tiled: 'true', > tilesOrigin : map.maxExtent.left + ',' + > map.maxExtent.bottom > }, > { > buffer: 0, > displayOutsideMaxExtent: true > } ,{isBaseLayer: false} > ); > > // setup single tiled layer > untiled = new OpenLayers.Layer.WMS( > "Untiled", "http://localhost:8080/geoserver/wms", > { > layers: 'KhaoSomphot', > srs: 'EPSG:24047', > height: '400', > format: format > }, > {singleTile: true, ratio: 1} ,{isBaseLayer: false} > ); > > var herb = new OpenLayers.Layer.Vector("KML", { > projection: map.displayProjection, > strategies: [new OpenLayers.Strategy.Fixed()], > protocol: new OpenLayers.Protocol.HTTP({ > url: "kml/doc.kml", > format: new OpenLayers.Format.KML({ > extractStyles: true, > extractAttributes: true > }) > }) > });
Have you tried setting "projection" to "new OpenLayers.Projection("EPSG:4326")" in your vector layer so OpenLayers reprojects your KML data to your map projection? Cheers, -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : eric.lemo...@camptocamp.com http://www.camptocamp.com _______________________________________________ Users mailing list Users@openlayers.org http://openlayers.org/mailman/listinfo/users