Problem with polar projection on Antartica

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem with polar projection on Antartica

springrider
Good evening

In the framework of my project, I should be able to provide different projections for the same layer. It concerns mainly polar projections.

I am now struggling for several hours trying to reproject a layer based on the antartic polar sterographic projection (EPSG:3031).
Here some details on the projection : http://nsidc.org/data/atlas/epsg_3031.html
and this is my code:

        var options = {
                projection: new OpenLayers.Projection("EPSG:3031"),
                units: 'meters',
                maxResolution: 'auto',
                maxExtent: new OpenLayers.Bounds(-12400000,-12400000,12400000,12400000)
        };
        var map = new OpenLayers.Map('map', options);
        var basemap = new OpenLayers.Layer.WMS( "test",
                "http://193.43.36.238:8484/geoserver/wms?service=wms",
                {layers: 'fifao:CONTINEENT_GAUL'});
        map.addLayer(basemap);
        map.zoomToMaxExtent();

I am using OL 2.6 but not proj4js, i don't know if it can impact.
Anyway, i don't understand why it does not work so if someone could give me some directions or hints, i would be very grateful.

Thanks in advance

Sylvain
Reply | Threaded
Open this post in threaded view
|

Re: Problem with polar projection on Antartica

Jon Blower
Hi Sylvain,

You don't explain what you mean by "it doesn't work" but you will
almost certainly have to specify the projection of the basemap layer
explicitly, as well as the map.  If you check the requests from
openlayers to your server is it using the wrong SRS/CRS?

Cheers, Jon

>
> ---------- Forwarded message ----------
> From: springrider <[hidden email]>
> To: [hidden email]
> Date: Mon, 26 May 2008 10:24:34 -0700 (PDT)
> Subject: [OpenLayers-Users] Problem with polar projection on Antartica
>
> Good evening
>
> In the framework of my project, I should be able to provide different
> projections for the same layer. It concerns mainly polar projections.
>
> I am now struggling for several hours trying to reproject a layer based on
> the antartic polar sterographic projection (EPSG:3031).
> Here some details on the projection :
> http://nsidc.org/data/atlas/epsg_3031.html
> and this is my code:
>
>        var options = {
>                projection: new OpenLayers.Projection("EPSG:3031"),
>                units: 'meters',
>                maxResolution: 'auto',
>                maxExtent: new OpenLayers.Bounds(-12400000,-12400000,12400000,12400000)
>        };
>        var map = new OpenLayers.Map('map', options);
>        var basemap = new OpenLayers.Layer.WMS( "test",
>                "http://193.43.36.238:8484/geoserver/wms?service=wms",
>                {layers: 'fifao:CONTINEENT_GAUL'});
>        map.addLayer(basemap);
>        map.zoomToMaxExtent();
>
> I am using OL 2.6 but not proj4js, i don't know if it can impact.
> Anyway, i don't understand why it does not work so if someone could give me
> some directions or hints, i would be very grateful.
>
> Thanks in advance
>
> Sylvain
> --
> View this message in context: http://www.nabble.com/Problem-with-polar-projection-on-Antartica-tp17475860p17475860.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
>

--
--------------------------------------------------------------
Dr Jon Blower Tel: +44 118 378 5213 (direct line)
Technical Director Tel: +44 118 378 8741 (ESSC)
Reading e-Science Centre Fax: +44 118 378 6413
ESSC Email: [hidden email]
University of Reading
3 Earley Gate
Reading RG6 6AL, UK
--------------------------------------------------------------
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with polar projection on Antartica

springrider
Thanks Jon for your reply

Sorry I was not really explicit about the result i had.

This is the request which is sent to my Geoserver:
GET /geoserver/wms?service=wms&LAYERS=fifao:CONTINEENT_GAUL
&SRS=EPSG:3031&VERSION=1.1.1&REQUEST=GetMap&STYLES=
&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg
&BBOX=-12399999.999999989,8762666.666666664,8762666.66666668,29925333.333333332
&WIDTH=256&HEIGHT=256

So the SRS to be used is correct (3031) but what is sent for the bounding box seems to be wrong in respect to what i have specified...

As you were suggesting in one of your previous post, could it be related to ZoomToMaxExtent?

I tried to add the projection also for the baselayer but with no results:
        var basemap = new OpenLayers.Layer.WMS( "test",
                                "http://193.43.36.238:8484/geoserver/wms?version=1.1.1",
                                {layers: 'fifao:CONTINEENT_GAUL',
                                 srs: 'EPSG:3031'});
        basemap.addOptions({isBaseLayer: true});

Thanks for your help and for telling me if the options and the way i used them are corrects.

Cheers

Sylvain


Jon Blower wrote
Hi Sylvain,

You don't explain what you mean by "it doesn't work" but you will
almost certainly have to specify the projection of the basemap layer
explicitly, as well as the map.  If you check the requests from
openlayers to your server is it using the wrong SRS/CRS?

Cheers, Jon

>
> ---------- Forwarded message ----------
> From: springrider <springrider@hotmail.com>
> To: users@openlayers.org
> Date: Mon, 26 May 2008 10:24:34 -0700 (PDT)
> Subject: [OpenLayers-Users] Problem with polar projection on Antartica
>
> Good evening
>
> In the framework of my project, I should be able to provide different
> projections for the same layer. It concerns mainly polar projections.
>
> I am now struggling for several hours trying to reproject a layer based on
> the antartic polar sterographic projection (EPSG:3031).
> Here some details on the projection :
> http://nsidc.org/data/atlas/epsg_3031.html
> and this is my code:
>
>        var options = {
>                projection: new OpenLayers.Projection("EPSG:3031"),
>                units: 'meters',
>                maxResolution: 'auto',
>                maxExtent: new OpenLayers.Bounds(-12400000,-12400000,12400000,12400000)
>        };
>        var map = new OpenLayers.Map('map', options);
>        var basemap = new OpenLayers.Layer.WMS( "test",
>                "http://193.43.36.238:8484/geoserver/wms?service=wms",
>                {layers: 'fifao:CONTINEENT_GAUL'});
>        map.addLayer(basemap);
>        map.zoomToMaxExtent();
>
> I am using OL 2.6 but not proj4js, i don't know if it can impact.
> Anyway, i don't understand why it does not work so if someone could give me
> some directions or hints, i would be very grateful.
>
> Thanks in advance
>
> Sylvain
> --
> View this message in context: http://www.nabble.com/Problem-with-polar-projection-on-Antartica-tp17475860p17475860.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
>

--
--------------------------------------------------------------
Dr Jon Blower Tel: +44 118 378 5213 (direct line)
Technical Director Tel: +44 118 378 8741 (ESSC)
Reading e-Science Centre Fax: +44 118 378 6413
ESSC Email: jdb@mail.nerc-essc.ac.uk
University of Reading
3 Earley Gate
Reading RG6 6AL, UK
--------------------------------------------------------------
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with polar projection on Antartica

Eric Lemoine
On Tue, May 27, 2008 at 11:29 AM, springrider <[hidden email]> wrote:

>
> Thanks Jon for your reply
>
> Sorry I was not really explicit about the result i had.
>
> This is the request which is sent to my Geoserver:
> GET /geoserver/wms?service=wms&LAYERS=fifao:CONTINEENT_GAUL
> &SRS=EPSG:3031&VERSION=1.1.1&REQUEST=GetMap&STYLES=
> &EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg
> &BBOX=-12399999.999999989,8762666.666666664,8762666.66666668,29925333.333333332
> &WIDTH=256&HEIGHT=256

Do you think the rounding errors are the cause of your problem?


> So the SRS to be used is correct (3031) but what is sent for the bounding
> box seems to be wrong in respect to what i have specified...
>
> As you were suggesting in one of your previous post, could it be related to
> ZoomToMaxExtent?
>
> I tried to add the projection also for the baselayer but with no results:
>        var basemap = new OpenLayers.Layer.WMS( "test",
>                                "http://193.43.36.238:8484/geoserver/wms?version=1.1.1",
>                                {layers: 'fifao:CONTINEENT_GAUL',
>                                 srs: 'EPSG:3031'});
>        basemap.addOptions({isBaseLayer: true});

You have only one base layer so no need to set things at the layer
level, map level is fine.

--
Eric
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with polar projection on Antartica

springrider
Thanks Eric for your reply

I have fixed my problem and this is the code:

                var map, layer;
               
                map =new OpenLayers.Map("map", {maxExtent: new OpenLayers.Bounds(-8000000,-8000000,8000000,8000000), maxResolution: 25000, units:'meters', projection:"EPSG:3031"});
                layer = new OpenLayers.Layer.WMS( "test",
                        "http://localhost:8080/geoserver/wms?version=1.1.1",
                        {layers: 'fifao:FAO_AREAS_PROJ,fifao:continents_pg',projection: "EPSG:3031"});
                map.addLayer(layer);
               
                map.zoomToMaxExtent();

The point is that it works only when the layer corresponds to shapefile in my Geoserver and not to a table in my Oracle database. In that case, i obtain a white map.

I don't know if it is a GeoServer or an Oracle problem. If anyone has a any idea, keep me informed.

Anyway, thanks for your help.

Sylvain

Eric Lemoine-3 wrote
On Tue, May 27, 2008 at 11:29 AM, springrider <springrider@hotmail.com> wrote:
>
> Thanks Jon for your reply
>
> Sorry I was not really explicit about the result i had.
>
> This is the request which is sent to my Geoserver:
> GET /geoserver/wms?service=wms&LAYERS=fifao:CONTINEENT_GAUL
> &SRS=EPSG:3031&VERSION=1.1.1&REQUEST=GetMap&STYLES=
> &EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg
> &BBOX=-12399999.999999989,8762666.666666664,8762666.66666668,29925333.333333332
> &WIDTH=256&HEIGHT=256

Do you think the rounding errors are the cause of your problem?


> So the SRS to be used is correct (3031) but what is sent for the bounding
> box seems to be wrong in respect to what i have specified...
>
> As you were suggesting in one of your previous post, could it be related to
> ZoomToMaxExtent?
>
> I tried to add the projection also for the baselayer but with no results:
>        var basemap = new OpenLayers.Layer.WMS( "test",
>                                "http://193.43.36.238:8484/geoserver/wms?version=1.1.1",
>                                {layers: 'fifao:CONTINEENT_GAUL',
>                                 srs: 'EPSG:3031'});
>        basemap.addOptions({isBaseLayer: true});

You have only one base layer so no need to set things at the layer
level, map level is fine.

--
Eric
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with polar projection on Antartica

Eric Lemoine
You dont need the projection property in the WMS layer param, do you?
Cheers. Eric

2008/5/29, springrider <[hidden email]>:

>
> Thanks Eric for your reply
>
> I have fixed my problem and this is the code:
>
> var map, layer;
>
> map =new OpenLayers.Map("map", {maxExtent: new
> OpenLayers.Bounds(-8000000,-8000000,8000000,8000000), maxResolution: 25000,
> units:'meters', projection:"EPSG:3031"});
> layer = new OpenLayers.Layer.WMS( "test",
> "http://localhost:8080/geoserver/wms?version=1.1.1",
> {layers: 'fifao:FAO_AREAS_PROJ,fifao:continents_pg',projection:
> "EPSG:3031"});
> map.addLayer(layer);
>
> map.zoomToMaxExtent();
>
> The point is that it works only when the layer corresponds to shapefile in
> my Geoserver and not to a table in my Oracle database. In that case, i
> obtain a white map.
>
> I don't know if it is a GeoServer or an Oracle problem. If anyone has a any
> idea, keep me informed.
>
> Anyway, thanks for your help.
>
> Sylvain
>
>
> Eric Lemoine-3 wrote:
>>
>> On Tue, May 27, 2008 at 11:29 AM, springrider <[hidden email]>
>> wrote:
>>>
>>> Thanks Jon for your reply
>>>
>>> Sorry I was not really explicit about the result i had.
>>>
>>> This is the request which is sent to my Geoserver:
>>> GET /geoserver/wms?service=wms&LAYERS=fifao:CONTINEENT_GAUL
>>> &SRS=EPSG:3031&VERSION=1.1.1&REQUEST=GetMap&STYLES=
>>> &EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg
>>> &BBOX=-12399999.999999989,8762666.666666664,8762666.66666668,29925333.333333332
>>> &WIDTH=256&HEIGHT=256
>>
>> Do you think the rounding errors are the cause of your problem?
>>
>>
>>> So the SRS to be used is correct (3031) but what is sent for the bounding
>>> box seems to be wrong in respect to what i have specified...
>>>
>>> As you were suggesting in one of your previous post, could it be related
>>> to
>>> ZoomToMaxExtent?
>>>
>>> I tried to add the projection also for the baselayer but with no results:
>>>        var basemap = new OpenLayers.Layer.WMS( "test",
>>>
>>> "http://193.43.36.238:8484/geoserver/wms?version=1.1.1",
>>>                                {layers: 'fifao:CONTINEENT_GAUL',
>>>                                 srs: 'EPSG:3031'});
>>>        basemap.addOptions({isBaseLayer: true});
>>
>> You have only one base layer so no need to set things at the layer
>> level, map level is fine.
>>
>> --
>> Eric
>> _______________________________________________
>> Users mailing list
>> [hidden email]
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-polar-projection-on-Antartica-tp17475860p17537271.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> [hidden email]
> http://openlayers.org/mailman/listinfo/users
>
_______________________________________________
Users mailing list
[hidden email]
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with polar projection on Antartica

springrider
Right, only the projection at map declaration is enough.

Sylvain

Eric Lemoine-3 wrote
You dont need the projection property in the WMS layer param, do you?
Cheers. Eric

2008/5/29, springrider <springrider@hotmail.com>:
>
> Thanks Eric for your reply
>
> I have fixed my problem and this is the code:
>
> var map, layer;
>
> map =new OpenLayers.Map("map", {maxExtent: new
> OpenLayers.Bounds(-8000000,-8000000,8000000,8000000), maxResolution: 25000,
> units:'meters', projection:"EPSG:3031"});
> layer = new OpenLayers.Layer.WMS( "test",
> "http://localhost:8080/geoserver/wms?version=1.1.1",
> {layers: 'fifao:FAO_AREAS_PROJ,fifao:continents_pg',projection:
> "EPSG:3031"});
> map.addLayer(layer);
>
> map.zoomToMaxExtent();
>
> The point is that it works only when the layer corresponds to shapefile in
> my Geoserver and not to a table in my Oracle database. In that case, i
> obtain a white map.
>
> I don't know if it is a GeoServer or an Oracle problem. If anyone has a any
> idea, keep me informed.
>
> Anyway, thanks for your help.
>
> Sylvain
>
>
> Eric Lemoine-3 wrote:
>>
>> On Tue, May 27, 2008 at 11:29 AM, springrider <springrider@hotmail.com>
>> wrote:
>>>
>>> Thanks Jon for your reply
>>>
>>> Sorry I was not really explicit about the result i had.
>>>
>>> This is the request which is sent to my Geoserver:
>>> GET /geoserver/wms?service=wms&LAYERS=fifao:CONTINEENT_GAUL
>>> &SRS=EPSG:3031&VERSION=1.1.1&REQUEST=GetMap&STYLES=
>>> &EXCEPTIONS=application%2Fvnd.ogc.se_inimage&FORMAT=image%2Fjpeg
>>> &BBOX=-12399999.999999989,8762666.666666664,8762666.66666668,29925333.333333332
>>> &WIDTH=256&HEIGHT=256
>>
>> Do you think the rounding errors are the cause of your problem?
>>
>>
>>> So the SRS to be used is correct (3031) but what is sent for the bounding
>>> box seems to be wrong in respect to what i have specified...
>>>
>>> As you were suggesting in one of your previous post, could it be related
>>> to
>>> ZoomToMaxExtent?
>>>
>>> I tried to add the projection also for the baselayer but with no results:
>>>        var basemap = new OpenLayers.Layer.WMS( "test",
>>>
>>> "http://193.43.36.238:8484/geoserver/wms?version=1.1.1",
>>>                                {layers: 'fifao:CONTINEENT_GAUL',
>>>                                 srs: 'EPSG:3031'});
>>>        basemap.addOptions({isBaseLayer: true});
>>
>> You have only one base layer so no need to set things at the layer
>> level, map level is fine.
>>
>> --
>> Eric
>> _______________________________________________
>> Users mailing list
>> Users@openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Problem-with-polar-projection-on-Antartica-tp17475860p17537271.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
>
> _______________________________________________
> Users mailing list
> Users@openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
_______________________________________________
Users mailing list
Users@openlayers.org
http://openlayers.org/mailman/listinfo/users
Reply | Threaded
Open this post in threaded view
|

Re: Problem with polar projection on Antartica

coastalrocket
hello there,

I'm very much a geoserver/openlayers newbie but i've cobbled together a basic map showing blue marble imagery of the antartic region. The problem i have can be best described by the attached image - a radial section from the pole is not being displayed followed by a rectangluar section on the right hand side. The radial chunk missing i would have thought relates to the extent of my coverage stored in geoserver but it looks good - -180 to 180 on X and -48 to -90 on Y. I have no idea what would be causing the straight rectangular gap in the image. Image here: wms.png

I would appreciate any pointers to fixing this. As i say, i've only been using geoserver and openlayers for a day now. Before then i was happily doing unprojected google map code so this is my first WMS trial.

WMS is in EPSG:4030 but openlayers is projecting in EPSG:3031. I've used the bounds as described by nsdic.org: -12400000,-12400000,         12400000,12400000.

Here is the native SRS WKT from geoserver,  if relevant:  
* Native Spatial Reference System for Coverage: Generate Envelope after setting the property.
Native SRS WKT: GEOGCS["Unknown datum based upon the WGS 84 ellipsoid", DATUM["Not specified (based on WGS 84 ellipsoid)", SPHEROID["WGS 84", 6378137.0, 298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6030"]], PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH], AUTHORITY["EPSG","4030"]]

My Openlayers script;
        <script src="http://localhost:8081/geoserver/openlayers/OpenLayers.js" type="text/javascript"> </script>        <script defer="defer" type="text/javascript"> var map; var untiled; var tiled; function setHTML(response) { document.getElementById('nodelist').innerHTML = response.responseText; }; OpenLayers.IMAGE_RELOAD_ATTEMPTS = 5; OpenLayers.DOTS_PER_INCH = 25.4 / 0.28; function init(){ var bounds = new OpenLayers.Bounds( -12400000,-12400000, 12400000,12400000 ); var options = { controls: [], maxExtent: bounds, maxResolution: 25000, projection: "EPSG:3031", //WGS 84 / Antarctic Polar Stereographic units: 'meters' }; map = new OpenLayers.Map('map', options); // setup tiled layer tiled = new OpenLayers.Layer.WMS( "QQ:Antarctica_Image - Tiled", "http://localhost:8081/geoserver/wms", { width: '800', styles: '', height: '800', layers: 'QQ:Antarctica_Image', srs: 'EPSG:4030', format: 'image/png', tiled: 'true', tilesOrigin : "-180,-90" }, {buffer: 0} ); // setup single tiled layer untiled = new OpenLayers.Layer.WMS( "QQ:Antarctica_Image - Untiled", "http://localhost:8081/geoserver/wms", { width: '800', styles: '', height: '800', layers: 'QQ:Antarctica_Image', srs: 'EPSG:4030', format: 'image/png' }, {singleTile: true, ratio: 1} ); map.addLayers([untiled, tiled]); // setup controls and initial zooms map.addControl(new OpenLayers.Control.PanZoomBar()); map.addControl(new OpenLayers.Control.Navigation()); map.addControl(new OpenLayers.Control.Scale($('scale'))); map.addControl(new OpenLayers.Control.MousePosition({element: $('location')})); map.addControl(new OpenLayers.Control.LayerSwitcher()); //map.addControl(new OpenLayers.Control.OverviewMap()); map.zoomToExtent(bounds); // support GetFeatureInfo map.events.register('click', map, function (e) { document.getElementById('nodelist').innerHTML = "Loading... please wait..."; var url = map.layers[0].getFullRequestString( { request: "GetFeatureInfo", EXCEPTIONS: "application/vnd.ogc.se_xml", BBOX: map.getExtent().toBBOX(), X: e.xy.x, Y: e.xy.y, INFO_FORMAT: 'text/html', QUERY_LAYERS: map.layers[0].params.LAYERS, FEATURE_COUNT: 50, WIDTH: map.size.w, HEIGHT: map.size.h }, "http://localhost:8081/geoserver/wms" ); OpenLayers.loadURL(url, '', this, setHTML, setHTML); OpenLayers.Event.stop(e); }); } </script>