Hello Arnd, I thank you for the continuous help and explanations. I have been looking around to see if there is a way to create a vector layer from a shapefile or from a postGIS database and it seems like there isn't? I also saw in another post that changing the contents of the .prj file with change the shapefile's projections, but that didn't seem to make much of a difference.
So it seems the only way to get through this is to make a vector layer, but I'm not sure if it's possible with a shapefile or a database and that's all I have to work with... I did try the alert(map.getExtent().toBBOX()); and got: 9958811.234741,3248210.367583,10946989.136235,3638344.95988 and then I put this in the bbox param of my WMS url but that the effect of not showing my layer. I'm almost ready to give it up on this layer, but I really want to include it! And I am very grateful for all your kind advices, elshae On Thu, Dec 23, 2010 at 7:04 AM, Arnd Wippermann <[email protected]>wrote: > Hi elshae, > > you have declared a Layer.WMS. That is a raster layer and can not > clientside reprojected. You can request a WMS only in the map projection and > hope that the WMS server support this projection. > > A Layer.GML is a vector layer and the features can reprojected, if you > integrate proj4js (only needed for projections other than EPSG:4326 and > EPSG:900913). A vector layer can requested for a different projection than > the map projection with clientside reprojecting the response. > > From the distance it's difficult to get an idea, what could be the issue. I > don't know GeoServer or GeoServer Preview. > > You have to check the data, you want deliver through GeoServer. If it's > a shape, use some other program to check the data. > > You can also try to insert > alert(map.getExtent().toBBOX()); > at the end of the init function, after setCenter or zoomToExtent for your > map and the GeoServer Preview to get an idea of the extents. > > Arnd > > > > ------------------------------ > *Von:* IT Intern [mailto:[email protected]] > *Gesendet:* Mittwoch, 22. Dezember 2010 23:57 > > *An:* Arnd Wippermann > *Cc:* [email protected] > *Betreff:* Re: [OpenLayers-Users] Re: EPSG:4008 Layer Not Displaying > > Hello Arnd, > > Thank you for your continuous effort to help me work through this. I'm > not so sure where you said "You should control the extent of your data, > which you make availible through GeoServer." In GeoServer, if I select > any other EPSG other than 4008, the layer does not display correctly. By > default my map is 900913 because I use Open Street Map and Google as my base > layers. I'm very surprised that specifying the projection has no effect as > I've seen in the proj4js docs that it should be included... > > Setting the projection of a layer > ¶<http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js#Settingtheprojectionofalayer> > > If the layer's projection is different from the one used by the map, you > need to specify what projection that is: > > var layer = new OpenLayers.Layer.GML(geojsonUrl, > {format:OpenLayers.Format.GeoJSON, projection: new > OpenLayers.Projection("EPSG:28993")}); > > map.addLayer(layer); > > > http://trac.osgeo.org/openlayers/wiki/Documentation/Dev/proj4js > > I'm sorry for not understanding very well what to do next. When you say that > you think my problem is the data I want to display, could it mean that it > might be impossible to display this data on my map? > > Thank you very much for explaining all this to me, > > elshae > > > > On Wed, Dec 22, 2010 at 4:12 PM, Arnd Wippermann > <[email protected]>wrote: > >> Hi, >> >> var bounds = new OpenLayers.Bounds( >> -2880104.25, 2070327.125, >> -1038944.658, 3262434.769 >> ); >> surely describe nothing in degree. A map in degree units goes from -180 W >> to +180 E and -90 S to 90 N. A resolution of 7192 means, that one pixel >> displays an area of 7192 x 7192 square units, what is much more than 360x180 >> for the whole world in degree. It seems, that the data, which are displayed >> with GeoServer Preview, are not in degree and perhaps not in EPSG:4008 with >> the parameter "+proj=longlat +ellps=clrk66 +no_defs". You should control >> the extent of your data, which you make availible through GeoServer. >> >> By default is your map in EPSG:4326 as you create the map without a >> projection in the map options. >> >> Also has it no effect, if you add projection: "EPSG:4008" as a param to >> your WMS declaration. The WMS request get added SRS=EPSG:4326 as it is the >> map projection. >> >> I think the problem are the data, you want to display. >> >> Arnd >> >> >> >> ------------------------------ >> *Von:* IT Intern [mailto:[email protected]] >> *Gesendet:* Mittwoch, 22. Dezember 2010 16:34 >> *An:* Arnd Wippermann >> *Cc:* [email protected] >> >> *Betreff:* Re: [OpenLayers-Users] Re: EPSG:4008 Layer Not Displaying >> >> Hello Arnd, >> >> I tried out your suggestion but I am still at a lost here. I happened not >> to get any error messages, but my layer didn't appear at all when I changed >> these params. I tried with SRS 4326 and 900913 since my map has base layers >> of 900913 and overlays of 4326. I also changed the bbox to -20037508.34, >> -20037508.34, 20037508.34, 20037508.34 (the bbox of my current map). I also >> notice that for this EPSG:4008 layer I see >> -2369470.14441, 2720321.16942 >> Scale = 1 : 2854176M >> >> as opposed to another layer of mine (EPSG:4326) on my map which shows >> 98.29099, 28.50735 >> Scale = 1 : 2M >> >> In it's GeoServer preview. So at this point I'm assuming it has something >> to do with the scale of my layer.. >> >> In the OpenLayers code of the GeoServer preview, they have: >> >> 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", >> >> >> { >> height: '331', >> width: '512', >> layers: 'cite:sedac', >> styles: '', >> >> >> srs: 'EPSG:4008', >> 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", >> >> { >> >> height: '331', >> width: '512', >> layers: 'cite:sedac', >> styles: '', >> srs: 'EPSG:4008', >> >> >> format: format >> }, >> {singleTile: true, ratio: 1} >> ); >> >> map.addLayers([untiled, tiled]); >> >> >> I instead, set the params they have for their map in my layer because if I >> set my map specific to this layer, other layers won't work as expected... >> >> >> For the map I have: >> >> 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); >> >> and for my EPSG:4008 layer I have: >> >> >> var bounds = new OpenLayers.Bounds(-2880104.25, 2070327.125, -1038944.658, >> 3262434.769); >> var borders = new OpenLayers.Layer.WMS( >> "Borders", "http://localhost:8080/geoserver/wms", {id: >> 'borders', layers: 'cite:sedac', transparent: true, maxExtent: bounds, >> maxResolution: 7192.02965625, projection: "EPSG:4008", units: 'degrees'}, >> {isBaseLayer: false, displayInLayerSwitcher: true, visibility: true, >> displayOutsideMaxExtent: true} >> >> >> ); >> >> Any further help would be greatly appreciated :) >> >> Thank you, >> >> elshae >> >> >> >> >> >> On Tue, Dec 21, 2010 at 6:09 PM, Arnd Wippermann >> <[email protected]>wrote: >> >>> Hi, >>> >>> build the WMS request for your layer and test it in the browser. Change >>> the BBOX, SRS. Perhaps you get some error message. >>> >>> >>> http://localhost:8080/geoserver/wms?LAYERS=cite%3Asedac&FORMAT=image%2Fpng&VERSION=1.1.1&TRANSPARENT=true&SERVICE=WMS&REQUEST=GetMap&STYLES=&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=EPSG%3A4326&BBOX=-153.599297,-105.360751,165.451558,97.517659&WIDTH=942&HEIGHT=599 >>> >>> Arnd >>> >>> ------------------------------ >>> *Von:* IT Intern [mailto:[email protected]] >>> *Gesendet:* Dienstag, 21. Dezember 2010 23:19 >>> *An:* Arnd Wippermann >>> *Betreff:* Re: [OpenLayers-Users] Re: EPSG:4008 Layer Not Displaying >>> >>> Hi Arnd, thanks for your reply! Unfortunately that has not solved the >>> problem for me :( >>> >>> I set the bounds both on my map and layer individually and still that >>> layer does not display. >>> >>> I've also tried with the bounds I obtained from GeoServer, again no luck >>> :-/ >>> >>> var borders = new OpenLayers.Layer.WMS( >>> "Borders", "http://localhost:8080/geoserver/wms", >>> {id: 'borders', layers: 'cite:sedac', transparent: true, maxExtent: new >>> OpenLayers.Bounds(-2880104.25, 2070327.125, -1038944.658, 3262434.769), >>> projection: new OpenLayers.Projection('EPSG:4008'), units: 'm'}, >>> {isBaseLayer: false, displayInLayerSwitcher: true, visibility: true, >>> displayOutsideMaxExtent: true} >>> ); >>> >>> I still don't see why it is not working ... >>> >>> Many Thanks, >>> >>> elshae >>> >>> On Tue, Dec 21, 2010 at 2:28 PM, Arnd Wippermann <[email protected] >>> > wrote: >>> >>>> Hi, >>>> >>>> I would think, that the maxExtent is the part to change. >>>> >>>> Your map projection is EPSG:4326 by default, and EPSG:4008 is also a >>>> projection in longlat. >>>> >>>> With your maxExtent the visible response of the WMS are only a pixel. >>>> >>>> Try a maxExtent of -180,-90,180,90. Perhaps it solves your problem. >>>> >>>> Arnd >>>> >>>> -----Ursprüngliche Nachricht----- >>>> Von: [email protected] >>>> [mailto:[email protected]] Im Auftrag von elshae >>>> Gesendet: Dienstag, 21. Dezember 2010 15:50 >>>> An: [email protected] >>>> Betreff: [OpenLayers-Users] Re: EPSG:4008 Layer Not Displaying >>>> >>>> >>>> Thank you so much for the kind support. I see that this is definitely >>>> going >>>> in the right direction, but I am still not able to get it working. >>>> >>>> In my body tag I have the scripts >>>> >>>> <script src="./OpenLayers-2.10/OpenLayers.js"></script> >>>> <script src="./proj4js/lib/proj4js-combined.js"></script> //I did also >>>> try >>>> proj4js.js, but the docs said use this one? >>>> >>>> Then I have these before my map and layer declaration, also in the body >>>> tag >>>> >>>> Ext.onReady(function() { >>>> >>>> Proj4js.defs["EPSG:4008"] = "+proj=longlat +ellps=clrk66 >>>> +no_defs"; >>>> Proj4js.defs["SR-ORG:6627"] = "+proj=merc +lon_0=0 +k=1 >>>> +x_0=0 >>>> +y_0=0 +ellps=WGS84 +datum=WGS84 +units=m +no_defs"; >>>> Proj4js.defs["EPSG:4326"] = "+proj=longlat +ellps=WGS84 >>>> +datum=WGS84 +no_defs"; >>>> >>>> ... >>>> ... >>>> >>>> >>>> //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, projection: new >>>> OpenLayers.Projection("EPSG:4008")}, {isBaseLayer: false, >>>> displayInLayerSwitcher: true, visibility: true} >>>> ); >>>> >>>> >>>> Still nothing shows up :(. Am I doing something wrong? I'm not seeing >>>> the >>>> error... >>>> >>>> Thank you very much for your time, >>>> >>>> elshae >>>> -- >>>> View this message in context: >>>> >>>> http://osgeo-org.1803224.n2.nabble.com/EPSG-4008-Layer-Not-Displaying-tp5838 >>>> 081p5855542.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
