I think the golden rule on projections and OpenLayers is that if you are using something besides WGS-84 (4326) or Google Mercator (900913) you need to include proj4js ...
On Wed, Dec 15, 2010 at 11:05 AM, elshae <[email protected]> wrote: > > Hello Openlayers users, > > I've had issues with layer projection before, but this time around no > matter > what I do I cannot get this layer to show on my map. I can view the layer > just fine in Geoserver, but it doesn't show anything on my OpenLayers map > :(. I tried to use both a layer created directly from a shapefile and one > created from the database I obtained from that shapefile using shp2sql. > I've tried changing all types of properties in the layer's config, but > shouldn't this layer just be able to reproject on my map according to the > base layer as all my other overlays have done? I point out that this layer > is EPSG:4008 as this is the information I got from the shapefile. I have > tried to set the EPSG to something else in Geoserver, and sometimes the > layer shows, but it does not show in the proper place. Should I find a > replacement SRID? I do not know what SRID, if any I could replace > EPSG:4008 > with, or is this just a matter of layer config I haven't set? > > Here's the Geoserver code for the map and the layer both tiled and untiled: > > var bounds = new OpenLayers.Bounds( > -2880104.25, 2070327.125, > -1038944.658, 3262434.769 > ); > var options = { > controls: [], > maxExtent: bounds, > maxResolution: 7192.02965625, > projection: "EPSG:4008", > units: 'degrees' > }; > map = new OpenLayers.Map('map', options); > > // setup tiled layer > tiled = new OpenLayers.Layer.WMS( > "sedac - Tiled", "http://localhost:8080/geoserver/wms", > { > width: '512', > layers: 'cite:sedac', > styles: '', > srs: 'EPSG:4008', > height: '331', > format: format, > tiled: 'true', > tilesOrigin : map.maxExtent.left + ',' + > map.maxExtent.bottom > }, > { > buffer: 0, > displayOutsideMaxExtent: true > } > ); > > // setup single tiled layer > untiled = new OpenLayers.Layer.WMS( > "sedac - Untiled", > "http://localhost:8080/geoserver/wms", > { > width: '512', > layers: 'cite:sedac', > styles: '', > srs: 'EPSG:4008', > height: '331', > format: format > }, > {singleTile: true, ratio: 1} > ); > > map.addLayers([untiled, tiled]); > > And here's my code, attempt one of many: > //My map > > //Map properties > var options = { > controls: [new > OpenLayers.Control.Navigation()], //Needed to use GeoExt > controls such as the zoomslider > maxExtent: new OpenLayers.Bounds(-20037508.34, > -20037508.34, > 20037508.34, 20037508.34), > units: 'm', > allOverlays: false //Do not display all layers on > load > } > > var map = new OpenLayers.Map(options); > > var borders = new OpenLayers.Layer.WMS( > "Borders", "http://localhost:8080/geoserver/wms", > {id: > 'borders', layers: 'cite:sedac', transparent: true, srs:'EPSG:4008'}, > {isBaseLayer: false, displayInLayerSwitcher: true, visibility: true, > maxExtent: new OpenLayers.Bounds(-2880104.25, 2070327.125, -1038944.658, > 3262434.769)} > ); > > //Adding the layer > map.addLayers([borders]); > > And yes I did notice that they set different bounds for the map than I do, > but I need the bounds I have for my other layers. > > Please note that I have already tried without setting the layer's maxExtent > and srs. Thank you for your time, it is very appreciated. > > elshae > > > > > -- > View this message in context: > http://osgeo-org.1803224.n2.nabble.com/EPSG-4008-Layer-Not-Displaying-tp5838081p5838081.html > Sent from the OpenLayers Users mailing list archive at Nabble.com. > _______________________________________________ > Users mailing list > [email protected] > http://lists.osgeo.org/mailman/listinfo/openlayers-users >
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
