[Geoserver-devel] GeoServer unable to compute intersection when unit of longitudes are in different format

org.geoserver.wcs.DefaultWebCoverageService100.computeIntersectionEnvelop(GeneralEnvelope requestedEnvelope, GeneralEnvelope nativeEnvelope) returns correctly computed intersection for below case:









However, org.geoserver.wcs.DefaultWebCoverageService100.computeIntersectionEnvelop(GeneralEnvelope requestedEnvelope, GeneralEnvelope nativeEnvelope) returns NULL for below envelopes.









The first envelope was created from WPS post request with below envelope information:

<ns1:Envelope srsName=“EPSG:4326”>

<gml:pos xmlns:gml=“http://www.opengis.net/gml”>-168.075 12.925</gml:pos>

<gml:pos xmlns:gml=“http://www.opengis.net/gml”>-149.925 31.075</gml:pos>

</ns1:Envelope>

The second envelope was created from WPS post request with below envelope information:

<ns1:Envelope srsName=“EPSG:4326”>

<gml:pos xmlns:gml=“http://www.opengis.net/gml”>191.925 12.925</gml:pos>

<gml:pos xmlns:gml=“http://www.opengis.net/gml”>210.075 31.075</gml:pos>

</ns1:Envelope>

For both cases, the requestedEnvelope references the same area. The only difference is that one is in [-180:180] format and the other is in [0:360] format for longitudes.

Is this known issue? Or is the requestedEnvelope in second case incorrectly created and should be using some other CRS?


Joseph Shin

We are what we repeatedly do. Excellence then is not an act but a habit.

On Fri, Aug 22, 2014 at 6:34 PM, Joseph Shin <koritoss@anonymised.com> wrote:

org.geoserver.wcs.DefaultWebCoverageService100.computeIntersectionEnvelop(GeneralEnvelope
requestedEnvelope, GeneralEnvelope nativeEnvelope) returns correctly
computed intersection for below case:

However, org.geoserver.wcs.DefaultWebCoverageService100.computeIntersectionEnvelop(GeneralEnvelope
requestedEnvelope, GeneralEnvelope nativeEnvelope) returns NULL for below
envelopes.

The first envelope was created from WPS post request with below envelope
information:

<ns1:Envelope srsName="EPSG:4326">

                                    <gml:pos xmlns:gml="
http://www.opengis.net/gml&quot;&gt;\-168\.075 12.925</gml:pos>

                                    <gml:pos xmlns:gml="
http://www.opengis.net/gml&quot;&gt;\-149\.925 31.075</gml:pos>

                 </ns1:Envelope>

The second envelope was created from WPS post request with below envelope
information:

<ns1:Envelope srsName="EPSG:4326">

                                    <gml:pos xmlns:gml="
http://www.opengis.net/gml&quot;&gt;191\.925 12.925</gml:pos>

                                    <gml:pos xmlns:gml="
http://www.opengis.net/gml&quot;&gt;210\.075 31.075</gml:pos>

                </ns1:Envelope>

*For both cases, the requestedEnvelope references the same area. The only
difference is that one is in [-180:180] format and the other is in [0:360]
format for longitudes.*

Is this known issue? Or is the requestedEnvelope in second case
incorrectly created and should be using some other CRS?

We are not wrapping the wgs84 coordinates if that's what you mean, you'll
have to use the same range for the
two bounding boxes, always stay in the -180,180 one in particular.

I guess we could wrap them, yes, but it would break cases (not uncommon
unfortunately) where people
just set 4326 because they don't know the actual coordinate reference
system, and their data is projected

Feel free to make a pull request to add coordinate wrapping, with some
system variable to enable/disable it

Cheers
Andrea

--

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

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

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

-------------------------------------------------------

(attachments)

image001.png
image004.jpg
image002.jpg
image003.jpg

My apology if previous post was bit unclear.

Here is more details along with more specific questions.

When client sends WPS post request with WCS getCoverage wrapped in to the post body,

  • if EPSG:4326 is specified as coordinate reference system along with envelopes in [-180:180] format, GeoServer is able to service that request and successfully serve up the data to the client.
  • however, if EPSG:4326 is specified as CRS along with envelopes pointing to same bounding box but in [0:360] format, GeoServer throws null pointer exception.

My expectation was GeoServer being able to interpret that the both requests are actually referencing the same area and successfully service the request. But that is not the case here.

Question I have is,

  1. Does GeoServer mandate that the envelopes information to be in [-180:180] format when using EPSG:4326 coordinate system?

  2. If yes, then what coordinate reference system should I be using if the envelope information is in [0:360]?

Thanks

(attachments)

image003.jpg
image001.png
image002.jpg
image004.jpg

···

On Fri, Aug 22, 2014 at 10:13 AM, Andrea Aime <andrea.aime@anonymised.com> wrote:


Joseph Shin

We are what we repeatedly do. Excellence then is not an act but a habit.

On Fri, Aug 22, 2014 at 6:34 PM, Joseph Shin <koritoss@anonymised.com> wrote:

org.geoserver.wcs.DefaultWebCoverageService100.computeIntersectionEnvelop(GeneralEnvelope requestedEnvelope, GeneralEnvelope nativeEnvelope) returns correctly computed intersection for below case:









However, org.geoserver.wcs.DefaultWebCoverageService100.computeIntersectionEnvelop(GeneralEnvelope requestedEnvelope, GeneralEnvelope nativeEnvelope) returns NULL for below envelopes.









The first envelope was created from WPS post request with below envelope information:

<ns1:Envelope srsName=“EPSG:4326”>

<gml:pos xmlns:gml=“http://www.opengis.net/gml”>-168.075 12.925</gml:pos>

<gml:pos xmlns:gml=“http://www.opengis.net/gml”>-149.925 31.075</gml:pos>

</ns1:Envelope>

The second envelope was created from WPS post request with below envelope information:

<ns1:Envelope srsName=“EPSG:4326”>

<gml:pos xmlns:gml=“http://www.opengis.net/gml”>191.925 12.925</gml:pos>

<gml:pos xmlns:gml=“http://www.opengis.net/gml”>210.075 31.075</gml:pos>

</ns1:Envelope>

For both cases, the requestedEnvelope references the same area. The only difference is that one is in [-180:180] format and the other is in [0:360] format for longitudes.

Is this known issue? Or is the requestedEnvelope in second case incorrectly created and should be using some other CRS?

We are not wrapping the wgs84 coordinates if that’s what you mean, you’ll have to use the same range for the
two bounding boxes, always stay in the -180,180 one in particular.

I guess we could wrap them, yes, but it would break cases (not uncommon unfortunately) where people
just set 4326 because they don’t know the actual coordinate reference system, and their data is projected

Feel free to make a pull request to add coordinate wrapping, with some system variable to enable/disable it

Cheers
Andrea

==

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

==

Ing. Andrea Aime

@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

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


On Fri, Aug 22, 2014 at 8:59 PM, Joseph Shin <koritoss@anonymised.com> wrote:

My apology if previous post was bit unclear.

Here is more details along with more specific questions.

When client sends WPS post request with WCS getCoverage wrapped in to the
post body,
- if EPSG:4326 is specified as coordinate reference system along with
envelopes in [-180:180] format, GeoServer is able to service that request
and successfully serve up the data to the client.
- however, if EPSG:4326 is specified as CRS along with envelopes pointing
to same bounding box but in [0:360] format, GeoServer throws null pointer
exception.

My expectation was GeoServer being able to interpret that the both
requests are actually referencing the same area and successfully service
the request. But that is not the case here.

Question I have is,
1. Does GeoServer mandate that the envelopes information to be in
[-180:180] format when using EPSG:4326 coordinate system?

Not in all services, but in WCS it does.

2. If yes, then what coordinate reference system should I be using if the
envelope information is in [0:360]?

I'm not aware of such a coordinate system.

Are you trying to make requests crossing the dateline by any chance? This
is only supported properly
by WMS, and will be by WCS 2.0 in a few months

Cheers
Andrea

--

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

Ing. Andrea Aime
@geowolf
Technical Lead

GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549

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

-------------------------------------------------------