Hi, I'm just following up on the post I made last week. I've done some more investigation on what was the reason why I was getting my feature geometries having a YX coord sequence even if I've specifically asked for it to be in XY sequence using
final Hints hints = new Hints(Hints.FORCE_LONGITUDE_FIRST_AXIS_ORDER, Boolean.TRUE); crsFactory = ReferencingFactoryFinder.getCRSAuthorityFactory("EPSG", hints); I have access to two datasets, the first one returns this GML snippet... <wfs:FeatureCollection> <gml:featureMembers> <DPCD:BH2010_Estates gml:id="BH2010_Estates.1"> <DPCD:gid>1</DPCD:gid> <DPCD:estatename>Manor Lakes</DPCD:estatename> <DPCD:the_geom> <gml:MultiSurface srsDimension="2" srsName="urn:x-ogc:def:crs:EPSG:4283"> <gml:surfaceMember> <gml:Polygon srsDimension="2"> <gml:exterior> <gml:LinearRing srsDimension="2"> <gml:posList>-37.88634 144.6066 -37.885634 144.602371 -37.885627 144.602335 -37.885593 ...</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> </gml:surfaceMember> </gml:MultiSurface> </DPCD:the_geom> </DPCD:BH2010_Estates> </gml:featureMembers> </wfs:FeatureCollection> And the second dataset returns this... <wfs:FeatureCollection> <gml:boundedBy> <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/def/crs/EPSG/0/4283"> <gml:lowerCorner>-37.73385732 144.74719276000008</gml:lowerCorner> <gml:upperCorner>-37.66292699 144.84819889000005</gml:upperCorner> </gml:Envelope> </gml:boundedBy> <gml:featureMember> <wescml-sf0:CombinedMeterReadings gml:id="CombinedMeterReadings.fid--2dd7eee8_14d0d6ba0c6_45e8"> <gml:boundedBy> <gml:Envelope srsDimension="2" srsName="http://www.opengis.net/def/crs/EPSG/0/4283"> <gml:lowerCorner>-37.73385732 144.74719276000008</gml:lowerCorner> <gml:upperCorner>-37.66292699 144.84819889000005</gml:upperCorner> </gml:Envelope> </gml:boundedBy> <wescml-sf0:aggregationID> http://wescml.org/yvw-water/combined-meter-readings/2000000 </wescml-sf0:aggregationID> <wescml-sf0:geometryID>3036</wescml-sf0:geometryID> <wescml-sf0:spatialRepresentation> <gml:MultiSurface srsDimension="2" srsName="http://www.opengis.net/def/crs/EPSG/0/4283"> <gml:surfaceMember> <gml:Polygon srsDimension="2" srsName="http://www.opengis.net/gml/srs/epsg.xml#4283"> <gml:exterior> <gml:LinearRing srsDimension="2"> <gml:posList>-37.72848142 144.8301788 -37.72850366999995 144.83013113000004 ...</gml:posList> </gml:LinearRing> </gml:exterior> </gml:Polygon> </gml:surfaceMember> </gml:MultiSurface> </wescml-sf0:spatialRepresentation> <wescml-sf0:propertyTypeURI>http://wescml.org/def/ResidentialProperty</wescml-sf0:propertyTypeURI> </wescml-sf0:CombinedMeterReadings> </gml:featureMember> </wfs:FeatureCollection> Now, here's the interesting part, for the first example, I get the coordinate sequence right ie XY (long/lat) which is what I requested. And for the second dataset, I get YX (lat/long) still. And the cause of this?? See line 529 of https://github.com/geotools/geotools/blob/master/modules/unsupported/wfs/src/main/java/org/geotools/data/wfs/v1_1_0/WFS_1_1_0_DataStore.java Is there a reason why the colon is needed in the comparison if (supportedCRSIdentifier.endsWith(":" + epsgCode)) Why is http://www.opengis.net/def/crs/EPSG/0/4283 treated differently from urn:x-ogc:def:crs:EPSG:4283 Regards, Gerson On Wed, May 6, 2015 at 11:51 AM, Gerson Galang <gerson.sa...@gmail.com> wrote: > Hi, > > I'd like to know if there's a way to force the coordinate sequence to > be in long/lat if I am talking to a WFS 1.1 service. > > This page (http://docs.geoserver.org/latest/en/user/services/wfs/basics.html) > talks about using either of the following formats EPSG:XXXX or > http://www.opengis.net/gml/srs/epsg.xml#xxxx. This method works if I > use this format as the value of the SRSName if I send my request > directly to the WFS service via POST or GET request. But if I use > geotools and setup my query like this... > > // ... set up the other query parameters > // and now the SRS name > CoordinateReferenceSystem crs = > crsFactory.createCoordinateReferenceSystem("EPSG:4283"); > query.setCoordinateSystem(crs); > featureSource.getFeatures(query); > > The call to adaptQueryForSupportedCRS((Query) query) will return an > srsName in either these formats.. > > http://www.opengis.net/def/crs/EPSG/0/XXXX > or > urn:x-ogc:def:crs:EPSG:xxxx > > If GT gives me the above two formats, I will always end up with a Y-X > (lat/long) sequence in all my feature collection. Is there a way go > around this issue? > > Thanks, > Gerson ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ GeoTools-GT2-Users mailing list GeoTools-GT2-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users