[OpenLayers-Users] Problem Setting maxExtent for Polar Projection(EPSG:3995)

Arnd Wippermann arnd.wippermann at web.de
Sat Nov 23 05:25:57 PST 2013


Hi Scott,
 
the Graticule Control is used to display a longitude, latitude grid on the
map. That's what you want.
But it seems, that the Graticule not works very well for polar projections.
The OpenLayers example 
shows some strange results, if you pan or zoom.
 
If you only want a grid without labels, then it will be easier to use a
static file with the grid. 
 
The GraticuleXY is a modification of the Graticule to display an orthogonal
grid in the map projection on the map.
For most cases it may be useless. I work often with projection Gausss-Kruger
and UTM and in these cases it is usefull
to have a grid in map projection.
 
example with Graticule, GraticuleXY and static grid file 
http://gis.ibbeck.de/ginfo/apps/OLExamples/OL212/world_3411_new.asp
 
Regards,
Arnd

  _____  

Von: Scott Chilcote [mailto:scottchilcote at yahoo.com] 
Gesendet: Freitag, 22. November 2013 20:37
An: arnd.wippermann at web.de
Cc: openlayers-users at lists.osgeo.org
Betreff: Re: AW: [OpenLayers-Users] Problem Setting maxExtent for Polar
Projection(EPSG:3995)


Hello Arnd,

Thanks very much for your help.  The OLC 210 Cache site is very helpful, as
was your message. 

I was able to fix my OpenLayers projection by switching to meters, and
removing the resolution values I had declared.  They were calculated for
degrees, not meters!  You can see from the map image I have attached that it
looks much better now.

You can also see from the black lines in the center and the black smear at
the bottom that the graticule does not work for this projection.  It worked
fine for the default projection, EPSG:4326.

So I have one more question for you, if you can help.  It is about a mesage
that you answered on this mailing list last year.

>From this message thread:
<http://osgeo-org.1560.x6.nabble.com/Graticule-Layer-not-in-latlng-td4989063
.html>
http://osgeo-org.1560.x6.nabble.com/Graticule-Layer-not-in-latlng-td4989063.
html
You mention that the OpenLayers Graticule control does not work correctly
for projections that use units of meters.  You also mention that you needed
to re-implement the Graticule.js code to use map units.  And on the
http://gis.ibbeck.de/OLClient, I see that there is
OpenLayers.Control.GraticuleXY().

My question relates to the Graticule Demo for OpenLayers v2.13, located
here:
 
<http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/graticule.htm
l>
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/graticule.html
 
<http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/graticule.htm
l> 

If you look at the map on the right side, you can see that it uses a
graticule for a polar projection.  If you look at the page source, you will
see that the projection is defined for Proj.4 and has units of meters.  This
graticule control (graticuleCtl2) is using OpenLayers.Control.Graticule().

So my question is simply, why does this demo work?  Has support for the
Graticule in map units been added to OpenLayers?  It is certainly not
working on my map, which uses nearly identical syntax to define the
graticule control.  

In fact, if I view my map with its broken graticule and then display this
demo web page, it stops working there too  :-P

Thanks again for any clues!  I really appreciate the help.

Scott


--
Scott Chilcote
scottchilcote at yahoo.com



On Tuesday, November 19, 2013 4:47 PM, Arnd Wippermann
<arnd.wippermann at web.de> wrote:

Hi Scott,

The maxExtent have to be set in map projections coordinates. 
EPSG:3995 is a projection with the north pole as center and the coordinates
0,0. 
The maxExtent in the OL example describe a square with the north pole in the
center.

As you want your map in projection EPSG:3995, you don't need the maxExtent
in UTM coordinates.

Add maxResolution: 43008.234375 ( = 5505054 / 128) to your map options and
zoom to maxExtent.

See this example
http://gis.ibbeck.de/OLClient/OLClient.asp?WMC=data/wmc/epsg_3995_Arctic_pol
ar.wmc.xml

Arnd


-----Ursprüngliche Nachricht-----
Von: openlayers-users-bounces at lists.osgeo.org
[mailto:openlayers-users-bounces at lists.osgeo.org] Im Auftrag von ScottCh
Gesendet: Dienstag, 19. November 2013 18:16
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] Problem Setting maxExtent for Polar
Projection(EPSG:3995)

Hello OpenLayers Users,

I appear to be setting the maxExtent values for my EPSG:3995 projection
incorrectly.

According to  http://spatialreference.org/ref/epsg/3995/
<http://spatialreference.org/ref/epsg/3995/>  , the bounds for this
projection in degrees are "everything north of 60 degrees north latitude" or
bounds -180, 60 and 180, 90.

I used the Earth Point online calculator (
http://www.earthpoint.us/convert.aspx
<http://www.earthpoint.us/convert.aspx>  ) to convert this to UTM.  This
gave me 332705mE 6655205mN and 2000000mE 2000000mN.

Does this mean that I need to use 332705, 6655205, 2000000, 2000000 as the
bounds in meters?  

This seems incorrect to me, in part because of this OpenLayers
implementation example:
http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/polar-projecti
ons.html
<http://dev.openlayers.org/releases/OpenLayers-2.13.1/examples/polar-project
ions.html>
The bounds used for each polar projection it provides are -5505054,
-5505054, 5505054, 5505054.

I looked up EPSG:3576 (which it uses), and it uses "everything above 45
degrees" for its bounds.  This suggests that my guess (to use UTM
conversion) is wrong.

I decided to try using the same maxExtent values as the polar projection
demo.

This gave me:

      map0 = new OpenLayers.Map(
        "Map", {
          controls:[
            new OpenLayers.Control.PanZoomBarMod({zoomWorldIcon:true,
forceFixedZoomLevel:true}),
            new OpenLayers.Control.ArgParser(),
            new OpenLayers.Control.Navigation(),
            new OpenLayers.Control.Attribution()
          ],
          projection: new OpenLayers.Projection('EPSG:3995'),
          units: 'm',
          //maxExtent:new OpenLayers.Bounds(-180,60,180,90),
          maxExtent:new OpenLayers.Bounds(-5505054, -5505054, 5505054,
5505054),
          
          numZoomLevels: 7
        }
      );

I show the bounds in degrees commented out as a form of documentation.  The
problem with this code is that it does not work properly.  When I display my
map in Firefox, it takes several seconds before showing a blank rectangle
for the map.  Then I get an "unresponsive script" alert box.  The map never
draws.  

I have experimented with other values for the maxExtent, and the results
vary a lot.  If I use the degree values on the commented out line, I get a
map that looks like this:

<http://osgeo-org.1560.x6.nabble.com/file/n5089954/olprojection.jpg> 

This map rendering has several problems. You can see from the edges of the
graticule that the extents are not set correctly.  The graticule is supposed
to be radial with the center at the north pole instead of rectangular.

At this point I have tried several different sets of values - admittedly
guesses - as the maxExtent bounds, and the results are always similar to
these two situations.  Either it times out and does not draw, or it draws
something similar to the standard EPSG:4326 projection over my base layer
map.  I have looked through a lot of documentation, but haven't found enough
clues yet.  Can someone point me in the right direction where to find out
how to correctly set the maxExtent bounds for my projection?

Thanks for your help,

Scott C.




--
View this message in context:
http://osgeo-org.1560.x6.nabble.com/Problem-Setting-maxExtent-for-Polar-Proj
ection-EPSG-3995-tp5089954.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20131123/e52aedfc/attachment-0001.html>


More information about the Users mailing list