[Geoserver-users] Wrong bounding box in layer with Sinusoidal projection

Hello

I’m having some trouble with a layer using the Sinusoidal projection. When I edit it’s configuration the calculated lat/long bounding box is wrong resulting in the layer being misplaced.

When I open the shapefile in QGIS Desktop (2.8.7-Wien) I can see that it uses the following projection definition (proj4):

+proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs

and, as there’s no sinusoidal projection in GeoServer’s SRS list, I added it to user_projections/epsg.properties under code 100001 where I copied the WKT text from the accompanying prj file (which I attached).

When I publish the layer I use the following SRS configuration, with bounding boxes calculated by geoserver:

Native SRS

UNKNOWN - Sinusoidal…

Declared SRS
EPSG:100001 - Sinusoidal…

Reproject (but I beleive it makes no difference)

Native BBOX

Min X : -5,510,409.794019982
Min Y : -3,667,583.4639999717
Máx X : -5,505,545.010496439
Máx Y : -3,662,718.6804764285

Lat/Lon BBOX

Min X : -59.07789581211166
Min Y : -33.158781662023415
Máx X : -58.99652065907146
Máx Y : -33.11491197687222

The problem is the Y coordinate of the Lat/Lon BBOX. GeoServer thinks it’s around -33.13. However, opening the shapefile in QGIS, and using on the fly SRS transformation to get WGS84 coordinates, I can see the layer located around (-59.03, -32.95).

I believe QGIS is showing the right coordinates because it’s putting it “in the right place” relative to other layers I have which use the WGS84 projection.

Anybody knows what’s going on? How can I debug it? Or fix it?

Thanks!
Diego


PS: My environment is as follows:

GeoServer 2.8.4
Container: Tomcat 7 (JBoss EWS 2.0) [at OpenShift]
Java:

java version “1.7.0_101”
OpenJDK Runtime Environment (rhel-2.6.6.1.el6_7-i386 u101-b00)
OpenJDK Server VM (build 24.95-b01, mixed mode)

grilla_modis_LC_MB.prj (293 Bytes)

Hi Diego,
I’m not sure… the sinusoidal projection was contributed by a 3rd party (not a core developer)
but I can see Daniele (cc’ed) made a few changes to it six months ago… not sure if that’s related or not.

However, I’ve tried your definition with cs2cs, the command line coordinate transformer based on the same
library as qgis, and I’m getting results consistent with GeoServer:

cs2cs +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs +init=epsg:4326 -f “%.2f”
-5510409 -3667583
-59.14 -33.17 -7122.67
-5505545 -3662718
-59.06 -33.13 -7122.69

Not sure how QGis is giving you other results? Could be version related, don’t know, the proj I have on my LTS distribution
is getting old:
Rel. 4.8.0, 6 March 2012

That said, I don’t see significant changes in proj for that projection, the two recent changes look just refactorings to me, not
bug fixes:
https://github.com/OSGeo/proj.4/commits/master/src/PJ_gn_sinu.c

Cheers
Andrea

···

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313

fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.


Hi

I’m not sure… the sinusoidal projection was contributed by a 3rd party (not a core developer)

Ok, don’t worry too much then. I don’t think it’s a great problem as there’s a workaround.

What I did in the meantime is to use ogr2ogr, a QGIS command-line tool, to reproject the shape file.

If I recall correctly, the invocation was

$ ogr2ogr -f “ESRI Shapefile” -t_srs EPSG:4326 dst/ src/original.shp

Then I used QGIS to recreate the spatial index and added the result to my GeoServer’s shapefiles directory. After recreating the layer the bounding box was fixed.

but I can see Daniele (cc’ed) made a few changes to it six months ago… not sure if that’s related or not.

However, I’ve tried your definition with cs2cs, the command line coordinate transformer based on the same
library as qgis, and I’m getting results consistent with GeoServer:

cs2cs +proj=sinu +lon_0=0 +x_0=0 +y_0=0 +a=6371007.181 +b=6371007.181 +units=m +no_defs +init=epsg:4326 -f “%.2f”
-5510409 -3667583
-59.14 -33.17 -7122.67
-5505545 -3662718
-59.06 -33.13 -7122.69

I get the same results from cs2cs.

Not sure how QGis is giving you other results? Could be version related, don’t know, the proj I have on my LTS distribution
is getting old:
Rel. 4.8.0, 6 March 2012

But just in case, I’m using QGIS OSGeo4W 2.8.7-1 x86_64 for Windows.

Thanks,
Diego

···

==
GeoServer Professional Services from the experts! Visit
http://goo.gl/it488V for more information.

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via di Montramito 3/A
55054 Massarosa (LU)
phone: +39 0584 962313

fax: +39 0584 1660272
mob: +39 339 8844549

http://www.geo-solutions.it
http://twitter.com/geosolutions_it

AVVERTENZE AI SENSI DEL D.Lgs. 196/2003

Le informazioni contenute in questo messaggio di posta elettronica e/o nel/i file/s allegato/i sono da considerarsi strettamente riservate. Il loro utilizzo è consentito esclusivamente al destinatario del messaggio, per le finalità indicate nel messaggio stesso. Qualora riceviate questo messaggio senza esserne il destinatario, Vi preghiamo cortesemente di darcene notizia via e-mail e di procedere alla distruzione del messaggio stesso, cancellandolo dal Vostro sistema. Conservare il messaggio stesso, divulgarlo anche in parte, distribuirlo ad altri soggetti, copiarlo, od utilizzarlo per finalità diverse, costituisce comportamento contrario ai principi dettati dal D.Lgs. 196/2003.

The information in this message and/or attachments, is intended solely for the attention and use of the named addressee(s) and may be confidential or proprietary in nature or covered by the provisions of privacy act (Legislative Decree June, 30 2003, no.196 - Italy’s New Data Protection Code).Any use not in accord with its purpose, any disclosure, reproduction, copying, distribution, or either dissemination, either whole or partial, is strictly forbidden except previous formal approval of the named addressee(s). If you are not the intended recipient, please contact immediately the sender by telephone, fax or e-mail and delete the information in this message that has been received in error. The sender does not give any warranty or accept liability as the content, accuracy or completeness of sent messages and accepts no responsibility for changes made after they were sent or for other risks which arise as a result of e-mail transmission, viruses, etc.