I understand that this is a difficult question. And the proposed
workaround works well ( --
System.setProperty("org.geotools.referencing.forceXY", "true"); -- )
However it seems strange to assign a CRS with specified axis order (x
-> y) and to get another one afterwards (y -> x) This does not seem to
be in line with your general policy of leaving the choice of the order
of axes.
On 05/01/2017, Jody Garnett <[email protected]> wrote:
> Yeah there never seems to be a good answer to axis order questions; no
> matter which way we handle things someone is confused.
>
> --
> Jody Garnett
>
> On 2 January 2017 at 09:35, Rémi Pace <[email protected]> wrote:
>
>> Ok, I wrote this mail a little too fast. I saw dedicated page on axis
>> order and it solved my problem.
>> (http://docs.geotools.org/latest/userguide/library/referencing/order.html)
>>
>> But if I can make an observation, as a beginner I think it is a little
>> bit strange to set a particular CRS and retrieve another.
>>
>> On 02/01/2017, Rémi Pace <[email protected]> wrote:
>> > Hello everyone ! And happy new year !
>> >
>> > It's still me with still a weird problem. I use H2 database and last
>> > Geotools version and I try to create feature schema with WGS84 CRS.
>> > But if I compare CRS which I tried to insert in schema, and CRS I get
>> > after insertion, they are different.
>> >
>> > Is that a correct behavior ? If I try to display features after that,
>> > inverted axes disrupt display.
>> >
>> > Here there is a simple demonstration:
>> > https://github.com/remipassmoilesel/abc-map2/
>> blob/master/src/test/java/org/abcmap/tests/demonstrations/
>> CRSSchemaDifferencesDemonstration.java
>> >
>> > // open h2 database
>> > Path database = Paths.get("tmp/crsDemonstration.db");
>> > JDBCDataStore datastore =
>> > SQLUtils.getGeotoolsDatastoreFromH2(database);
>> >
>> > // original crs used
>> > DefaultGeographicCRS originalCrs = DefaultGeographicCRS.WGS84;
>> >
>> > // create a feature type
>> > SimpleFeatureTypeBuilder tbuilder = new
>> SimpleFeatureTypeBuilder();
>> > tbuilder.setName("feature1");
>> > tbuilder.setCRS(originalCrs);
>> > tbuilder.add("geometry", Geometry.class);
>> > SimpleFeatureType type = tbuilder.buildFeatureType();
>> >
>> > // create a schema
>> > datastore.createSchema(type);
>> > CoordinateReferenceSystem schemaCrs =
>> > datastore.getFeatureSource(type.getTypeName()).getSchema().
>> getCoordinateReferenceSystem();
>> >
>> > // compare CRS
>> > System.out.println("originalCrs.equals(schemaCrs)");
>> > System.out.println(originalCrs.equals(schemaCrs));
>> >
>> > System.out.println();
>> > System.out.println("originalCrs");
>> > System.out.println(originalCrs);
>> >
>> > System.out.println();
>> > System.out.println("schemaCrs");
>> > System.out.println(schemaCrs);
>> >
>> > Output:
>> >
>> > originalCrs.equals(schemaCrs)
>> > false
>> >
>> > originalCrs
>> > GEOGCS["WGS84(DD)",
>> > DATUM["WGS84",
>> > SPHEROID["WGS84", 6378137.0, 298.257223563]],
>> > PRIMEM["Greenwich", 0.0],
>> > UNIT["degree", 0.017453292519943295],
>> > AXIS["Geodetic longitude", EAST],
>> > AXIS["Geodetic latitude", NORTH]]
>> >
>> > schemaCrs
>> > GEOGCS["WGS 84",
>> > DATUM["World Geodetic System 1984",
>> > SPHEROID["WGS 84", 6378137.0, 298.257223563,
>> > AUTHORITY["EPSG","7030"]],
>> > AUTHORITY["EPSG","6326"]],
>> > PRIMEM["Greenwich", 0.0, AUTHORITY["EPSG","8901"]],
>> > UNIT["degree", 0.017453292519943295],
>> > AXIS["Geodetic latitude", NORTH],
>> > AXIS["Geodetic longitude", EAST],
>> > AUTHORITY["EPSG","4326"]]
>> >
>> >
>> > Thanks for your help.
>> >
>> > --
>> >
>> >
>> >
>> >
>> > ***
>> >
>> > Rémi PACE
>> >
>> > http://remi-pace.fr
>> > https://github.com/remipassmoilesel
>> >
>> > Photographie:
>> > http://toutes-les-bulles-eclatent.fr
>> >
>>
>>
>> --
>>
>>
>>
>>
>> ***
>>
>> Rémi PACE
>>
>> http://remi-pace.fr
>> https://github.com/remipassmoilesel
>>
>> Photographie:
>> http://toutes-les-bulles-eclatent.fr
>>
>> ------------------------------------------------------------
>> ------------------
>> 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
>>
>
--
***
Rémi PACE
http://remi-pace.fr
https://github.com/remipassmoilesel
Photographie:
http://toutes-les-bulles-eclatent.fr
------------------------------------------------------------------------------
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