[OpenLayers-Users] wms+wfs+google with overlay+kml

Julien-Samuel Lacroix jlacroix at mapgears.com
Mon Jan 5 11:02:51 EST 2009


Hi,

Sorry if you didn't get a response earlier. Mailing-lists are always 
more quiet during the Holidays. If you didn't figure it out yet, here's 
some tips.

- Try to start from a working example like the spherical mercator one:
http://openlayers.org/dev/examples/spherical-mercator.html

- Does your WMS and WFS support the 900913 projection? Get the URL of 
your WMS image, with something like with FireBug (a FireFox extension), 
and see what it return.

- Your projection in your WMS is 28992. Is it compatible with the 900913 
of your map?

- In your WMS, you set the maxExtent and maxResolution in the wrong 
parameter. They should be in the fourth one, not the third one.

Hope that get you started.

Julien


cwest wrote:
> hi all,
>  i 've got a problem with nested layer,i set google as baselayer, 
>  wms,wfs,and kml as overlayers.I can show individual of them,but i
>  cant nested them all,maybe some difference of projection ,
>  Is there anyway that I can nested them.
> 
> follow is my code:
> ////////////////////////////////////
>  var map;
> 
>         function init(){
> 		OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
> 	    OpenLayers.Util.onImageLoadErrorColor = "transparent";
> 
> 		var bounds = new OpenLayers.Bounds(
>                   243000,466000,257000,482000//242300, 465200,257700,
> 482800//
>                 );
>                 var options = { 
>         projection: new OpenLayers.Projection("EPSG:900913"), 
>         displayProjection: new OpenLayers.Projection("EPSG:4326"), 
>         units: "m", 
>         maxResolution: 156543.0339, 
>         maxExtent: bounds
> 		}; 
> 
>          map = new OpenLayers.Map('map',options); //      nothing display
> when i add options
> 	 //map = new OpenLayers.Map('map');//           i can nested them except
> wfs when no options
>             
> 	var googlehybrid = new OpenLayers.Layer.Google( "Google Hybrid" ,
> {type:G_HYBRID_MAP,isBaseLayer: true});
> 
> 
> 
> 	wms = new OpenLayers.Layer.WMS( "OpenLayers WMS",
>                     "http://192.168.0.105:8081/geoserver/wms", {layers:
> 'topp:SW_PIPE',maxExtent: bounds,maxResolution: '68.75',projection:
> "EPSG:28992",units: 'm',tiled: 'true',transparent: true}
> 					//{reproject: true,opacity: 0.8,isBaseLayer: false} 
> 	);
> 	//layer1.transparent=true;
> 	wms.isBaseLayer=false;
> 
> 
> 	var wfs = new OpenLayers.Layer.WFS( "WFS",
> "http://192.168.0.105:8081/geoserver/wfs",
>          {typename: 'topp:RD_ROAD_OBJECT'},
>          {
>                     typename: 'topp:RD_ROAD_OBJECT',
>                     featureNS: 'http://www.openplans.org/topp',
>                     extractAttributes: false,
>                     visibility:false
> 	  },{ featureClass: OpenLayers.Feature.WFS});
> 
> 	kml=new OpenLayers.Layer.GML("KML0",
> "http://192.168.0.125:8080/geoserver/www/sw4.kml", 
>         {
>                 format: OpenLayers.Format.KML, 
>                formatOptions: {
>                   extractStyles: true, 
>                   extractAttributes: false
>              }
>         });
>   
> 
>             map.addLayers([googlehybrid,wms,wfs,kml]);
> 
>             map.setCenter(new
> OpenLayers.LonLat(6.785026240707595,52.27358741413968), 13);
> 
>             map.addControl( new OpenLayers.Control.LayerSwitcher() );
>         }
> ///////////////////////////////////////////////////////
> 
> Thanks in advance
> 
>  cwest

-- 
Julien-Samuel Lacroix
Mapgears
http://www.mapgears.com/



More information about the Users mailing list