Gaby,

on-list, please.

You should be able to use Query.setCoordinateSystemReproject which is I think the programmatic equivalent of setting srsName in a WFS GetFeature request, but I have not tested whether this in fact works.

Kind regards,
Ben.

On 10/01/18 13:14, Gabriella Turek wrote:
I see, yeah, I suppose I can just throw an exception when the CRS is not 
supported, but
assume that it is to begin with.
So programmatically I would pass the SRSNAME in the Query filter?
Thanx
Gaby

On 10/01/18, 13:06, "Ben Caradoc-Davies" <[email protected]> wrote:

    Gaby,

    in theory, the WFS GetCapabilities response lists all supported CRSs for
    each feature type, but in practice, because this would add 5000+
    otherSRS/otherCRS elements for each feature type (enumerating the
    contents of the EPSG database), these elements are not encoded. They can
    be configured by the server administrator:
    
http://docs.geoserver.org/latest/en/user/services/wfs/webadmin.html#configuring-additional-srs

    In practice, probe by trying a request with a particular CRS and
    detecting failure. A CRS in a recent EPSG database will be supported by
    recent GeoServer, for similar values of recent.

    Use SRSNAME to request that response geometries be reprojected to a
    particular CRS. Use a five-parameter BBOX to specify your BBOX in a CRS
    other than the default for the feature type. These two CRS do not have
    to be the same. They are orthogonal considerations.

    For example, using the demo bug sites layer (sf:archsites):

    Give me archsites.2 by BBOX (the default CRS is EPSG:26713):
    
http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeNames=sf:archsites&bbox=591949.5,4922999.5,591950.5,4923000.5

    Give me archsites.2 reprojected into WGS 84 with SRSNAME (note that the
    BBOX is still in EPSG:26713):
    
http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeNames=sf:archsites&bbox=591949.5,4922999.5,591950.5,4923000.5&srsname=http://www.opengis.net/def/crs/EPSG/0/4326

    Using WGS 84 BBOX coordinates fails because the BBOX defaults to
    EPSG:26713 (this returns no features):
    
http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeNames=sf:archsites&bbox=44.4562825,-103.8446375,44.4562835,-103.8446365&srsname=http://www.opengis.net/def/crs/EPSG/0/4326

    But we can select archsites.2 if we use a five parameter BBOX with WGS
    84 coordinates *and* specify that it is in WGS 84:
    
http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeNames=sf:archsites&bbox=44.4562825,-103.8446375,44.4562835,-103.8446365,http://www.opengis.net/def/crs/EPSG/0/4326&srsname=http://www.opengis.net/def/crs/EPSG/0/4326

    We can leave off the SRSNAME if we want to request in WGS 84 but still
    want the response geometries in its native EPSG:26713:
    
http://localhost:8080/geoserver/wfs?service=WFS&version=2.0.0&request=GetFeature&typeNames=sf:archsites&bbox=44.4562825,-103.8446375,44.4562835,-103.8446365,http://www.opengis.net/def/crs/EPSG/0/4326

    Kind regards,
    Ben.


    On 10/01/18 12:16, Gabriella Turek wrote:
    > I’ve gotten my client to interrogate a WFS service (thank you Ian!).
    > Now I have a question about how to handle CRSs.
    > With WFS, I can ask the service what CRS are supported and ask the 
service for maps in a specific CRS.
    > Is there something similar for WFS, or do I have to reproject on the 
client side (as needed).
    > If the latter, that means that if I am making a query filter that include 
a bbox, the bbox must be in the CRS of the service, correct?
    > Thanx
    > Gaby
    >
    >
    > 
------------------------------------------------------------------------------
    > Check out the vibrant tech community on one of the world's most
    > engaging tech sites, Slashdot.org! http://sdm.link/slashdot
    >

Dr Gabriella Turek
Senior Software Engineer

+64-4-386-0819 | 301 Evans Bay Parade, Greta Point, Wellington | 
www.niwa.co.nz<http://www.niwa.co.nz>
[NIWA]<http://www.niwa.co.nz>
To ensure compliance with legal requirements and to maintain cyber security 
standards, NIWA's IT systems are subject to ongoing monitoring, activity 
logging and auditing. This monitoring and auditing service may be provided by 
third parties. Such third parties can access information transmitted to, 
processed by and stored on NIWA's IT systems.
_______________________________________________
    > GeoTools-GT2-Users mailing list
    > [email protected]
    > https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
    >

    --
    Ben Caradoc-Davies <[email protected]>
    Director
    Transient Software Limited <https://transient.nz/>
    New Zealand







--
Ben Caradoc-Davies <[email protected]>
Director
Transient Software Limited <https://transient.nz/>
New Zealand

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to