[Geoserver-devel] EPSG-ACCESS and EPS-WKT

Hi List,
lately I have been messing around with projection and coordinate
reference systems and I found these topics somehow foggy.
A couple of issues were killing me:

1>While I was writing the GeoTiffWriter I was using the epsg-access
because I needed a complete set of factories for datum, cs etc...
Everything seemed to be working just fine until we plugged a beta
version of the plugin inside the WCS that me and Alessio are
developing exploiting GeoServer structure. Well once you expose a map
which mixes features from shapefiles and a geotiff grom a GridCoverage
the map gets turned upside down! That killed me so we decided to stop
the development of the GeoTiffWriter to dig a bit the problem, but due
to laking of time I have to give up to work on other things.

If someone is interested what the WMS does with GridCoverages is to
ask the WCS which just wraps them inside a feature.

2>While writing some code for reprojecting to WGS84 some images that
originally were in Standard Mercator, I ran into this problem again
since I was mixing code from a WKT string found in the espg-wkt text
with some code using epsg-access.

I solved it just switching the axes as Martin suggested me, and the
image came up turned just fine, even if nothing raelly happened, like
the reprojection had not been done!

This brings up two questions:
1>Is it my impression or the Standard Mercator 1 parallel projection
is not yeat supported in GeoTools? I think this since I get no errors
or exception but nothing happens. I hope someone can tell me somthing
or provide some code to do that.

2>Are epsg-access and epsg-wkt interchangeable?
To check this latter issue a wrote a small piece of code as follows:

//getting a factory from epsg-access
    //and anotehr one from epsg-wkt
    CRSAuthorityFactory
crsFactoryWKT=FactoryFinder.getCRSAuthorityFactory("EPSG", new
Hints(Hints.CRS_AUTHORITY_FACTORY,EPSGCRSAuthorityFactory.class)),
      crsFactoryEPSG=FactoryFinder.getCRSAuthorityFactory("EPSG", new
Hints(Hints.CRS_AUTHORITY_FACTORY,DefaultFactory
.class));
    CoordinateReferenceSystem
crsWKT=crsFactoryWKT.createCoordinateReferenceSystem("EPSG:4326"),
      crsEPSG=crsFactoryEPSG.createCoordinateReferenceSystem("EPSG:4326");
    System.out.println("Are they equals?");
    System.out.println(crsEPSG.toWKT().equalsIgnoreCase(crsWKT.toWKT()));

    System.out.println("epsg version of wgs84");
    System.out.println(crsEPSG.toWKT());
    System.out.println("");
    System.out.println("");
    
    System.out.println("wkt version of wgs84");
    System.out.println(crsWKT.toWKT());

Well surprisingly (at least for me :frowning: ) the result was the following:

Are they equals?
false
epsg
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, AUTHORITY["EPSG","106"]],
  AXIS["Geodetic longitude", EAST, AUTHORITY["EPSG","107"]],
  AUTHORITY["EPSG","4326"]]

wkt
GEOGCS["WGS 84",
  DATUM["WGS_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["Lon", EAST],
  AXIS["Lat", NORTH],
  AUTHORITY["EPSG","4326"]]

I strongly believe that the two descriptions should be almost the
same even if not completely equals, BUT HERE THE TWO AXES ARE
INVERTED!!!!
This explain the problems we have been experiencing in the WMS-WCS
side because of the fact that we were using epsg-access and epsg-wkt
at the same
time.

I really hope that someone can fix this up quickly, because this issue
(UNLESS IT IS ME MAKING A MISTAKE) is KILLING me!

Simone.

It's someone making a mistake Simone, but it isn't you, rest assured. I will wager that it is the WKT factory, since it was written by someone without a geodessy background, unlike the access factory.

The whole axis order thing it going to be problematic in udig, and we have been ignoring it, because our authority factory is actually returning the wrong answers.

P

simone giannecchini wrote:

Hi List,
lately I have been messing around with projection and coordinate
reference systems and I found these topics somehow foggy.
A couple of issues were killing me:

1>While I was writing the GeoTiffWriter I was using the epsg-access
because I needed a complete set of factories for datum, cs etc...
Everything seemed to be working just fine until we plugged a beta
version of the plugin inside the WCS that me and Alessio are
developing exploiting GeoServer structure. Well once you expose a map
which mixes features from shapefiles and a geotiff grom a GridCoverage
the map gets turned upside down! That killed me so we decided to stop
the development of the GeoTiffWriter to dig a bit the problem, but due
to laking of time I have to give up to work on other things.

If someone is interested what the WMS does with GridCoverages is to
ask the WCS which just wraps them inside a feature.

2>While writing some code for reprojecting to WGS84 some images that
originally were in Standard Mercator, I ran into this problem again
since I was mixing code from a WKT string found in the espg-wkt text
with some code using epsg-access.

I solved it just switching the axes as Martin suggested me, and the
image came up turned just fine, even if nothing raelly happened, like
the reprojection had not been done!

This brings up two questions:
1>Is it my impression or the Standard Mercator 1 parallel projection
is not yeat supported in GeoTools? I think this since I get no errors
or exception but nothing happens. I hope someone can tell me somthing
or provide some code to do that.

2>Are epsg-access and epsg-wkt interchangeable? To check this latter issue a wrote a small piece of code as follows:

//getting a factory from epsg-access
    //and anotehr one from epsg-wkt
    CRSAuthorityFactory
crsFactoryWKT=FactoryFinder.getCRSAuthorityFactory("EPSG", new
Hints(Hints.CRS_AUTHORITY_FACTORY,EPSGCRSAuthorityFactory.class)),
      crsFactoryEPSG=FactoryFinder.getCRSAuthorityFactory("EPSG", new
Hints(Hints.CRS_AUTHORITY_FACTORY,DefaultFactory
.class));
    CoordinateReferenceSystem
crsWKT=crsFactoryWKT.createCoordinateReferenceSystem("EPSG:4326"),
      crsEPSG=crsFactoryEPSG.createCoordinateReferenceSystem("EPSG:4326");
    System.out.println("Are they equals?");
    System.out.println(crsEPSG.toWKT().equalsIgnoreCase(crsWKT.toWKT()));

    System.out.println("epsg version of wgs84");
    System.out.println(crsEPSG.toWKT());
    System.out.println("");
    
    System.out.println("wkt version of wgs84");
    System.out.println(crsWKT.toWKT());

Well surprisingly (at least for me :frowning: ) the result was the following:

Are they equals?
false
epsg
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, AUTHORITY["EPSG","106"]], AXIS["Geodetic longitude", EAST, AUTHORITY["EPSG","107"]], AUTHORITY["EPSG","4326"]]

wkt
GEOGCS["WGS 84", DATUM["WGS_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["Lon", EAST], AXIS["Lat", NORTH], AUTHORITY["EPSG","4326"]]

I strongly believe that the two descriptions should be almost the
same even if not completely equals, BUT HERE THE TWO AXES ARE
INVERTED!!!!
This explain the problems we have been experiencing in the WMS-WCS
side because of the fact that we were using epsg-access and epsg-wkt
at the same
time.

I really hope that someone can fix this up quickly, because this issue
(UNLESS IT IS ME MAKING A MISTAKE) is KILLING me!

Simone.

-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

simone giannecchini a écrit :

1>Is it my impression or the Standard Mercator 1 parallel projection
is not yeat supported in GeoTools? I think this since I get no errors
or exception but nothing happens.

Mercator 1 parallel projection is supported in Geotools. If a projection is not supported, you should get an exception.

In the particular case of Mercator projection, one may get the illusion that nothing is done. This is because that at the difference of Conic or Stereographic projection (for example), the Cylindical Mercator projection keep parallels and meridians as straight lines crossing at right angles. The only visible difference compared to a plain latitude/longitude map is that parallels close to the poles are further apart. See:

     http://mathworld.wolfram.com/MercatorProjection.html

There is many way you can check if a projection has really be done:

- Print GridCoverage2D.getEnvelope() and check the coordinates.

- Invoke GridCoverage2D.getRenderedImage() and inspect the JAI
   operations. You can do that graphically using the
   org.geotools.gui.swing.ImageProperties widget (I invite you to
   try this widget; it is of some help for debugging image processing).

2>Are epsg-access and epsg-wkt interchangeable?

epsg
[...snip...]
  AXIS["Geodetic latitude", NORTH, AUTHORITY["EPSG","106"]], AXIS["Geodetic longitude", EAST, AUTHORITY["EPSG","107"]],

wkt
[...snip...]
  AXIS["Lon", EAST], AXIS["Lat", NORTH],

I checked in the EPSG database version 6.6, and the correct axis order is the one produced by EPSG-Access.

This explain the problems we have been experiencing in the WMS-WCS
side because of the fact that we were using epsg-access and epsg-wkt
at the same time.

Right. So we have a choice:

    1) Either someone fix the EPSG WKT property file.

or 2) A volunter go ahead and do GEOT-46, which could be a replacement
       for the WKT factory. See http://jira.codehaus.org/browse/GEOT-46

  Martin.

We really need to fix epsg-wkt since WMS is using it heavily (DBLASBY
AM I RIGHT?). Me or alessio could that but we need a bit of help and
maybe directions.
As far as it concerns with GEOT-46 I would like to have some
directions on how to do that in order to estimate how much time that
would take because I am running out of it right now.
Please, someone let me know because this is a big issue for us right now.
Simone.

On 5/18/05, Martin Desruisseaux <martin.desruisseaux@anonymised.com> wrote:

simone giannecchini a écrit :
> 1>Is it my impression or the Standard Mercator 1 parallel projection
> is not yeat supported in GeoTools? I think this since I get no errors
> or exception but nothing happens.

Mercator 1 parallel projection is supported in Geotools. If a projection
is not supported, you should get an exception.

In the particular case of Mercator projection, one may get the illusion
that nothing is done. This is because that at the difference of Conic or
Stereographic projection (for example), the Cylindical Mercator
projection keep parallels and meridians as straight lines crossing at
right angles. The only visible difference compared to a plain
latitude/longitude map is that parallels close to the poles are further
apart. See:

    http://mathworld.wolfram.com/MercatorProjection.html

There is many way you can check if a projection has really be done:

- Print GridCoverage2D.getEnvelope() and check the coordinates.

- Invoke GridCoverage2D.getRenderedImage() and inspect the JAI
  operations. You can do that graphically using the
  org.geotools.gui.swing.ImageProperties widget (I invite you to
  try this widget; it is of some help for debugging image processing).

> 2>Are epsg-access and epsg-wkt interchangeable?
>
> epsg
> [...snip...]
> AXIS["Geodetic latitude", NORTH, AUTHORITY["EPSG","106"]],
> AXIS["Geodetic longitude", EAST, AUTHORITY["EPSG","107"]],
>
> wkt
> [...snip...]
> AXIS["Lon", EAST],
> AXIS["Lat", NORTH],

I checked in the EPSG database version 6.6, and the correct axis order
is the one produced by EPSG-Access.

> This explain the problems we have been experiencing in the WMS-WCS
> side because of the fact that we were using epsg-access and epsg-wkt
> at the same time.

Right. So we have a choice:

   1) Either someone fix the EPSG WKT property file.

or 2) A volunter go ahead and do GEOT-46, which could be a replacement
      for the WKT factory. See http://jira.codehaus.org/browse/GEOT-46

       Martin.

OK, so the problem is: the WKT EPSG properties file does not have any information about axis order; the Access database does. The default axis order is EASTING/NORTHING, so that is what gets put into the CRS objects for the WKT factor. The axis order for 4326 is NORTHING/EASTING, so that is what gets (correctly) populated from the database.

So everyone is right, except me. To make this "work", "correctly", I would have to add axis order information to the epsg.properties file. While doing so, I would break uDig, which has been using epsg.properties as its source of information.

Trivia question for geoserver developers: if I request a feature set from geoserver in EPSG:4326, what is the ordinate order? northing/easting or easting/northing? if the latter, you too are breaking the EPSG contract. For better or worse, it is a VERY LARGE CLUB of people breaking the contract. It is hard to know whether it is more (practically) interoperable to honor the contract or not at this point.

Paul

Paul Ramsey wrote:

It's someone making a mistake Simone, but it isn't you, rest assured. I will wager that it is the WKT factory, since it was written by someone without a geodessy background, unlike the access factory.

The whole axis order thing it going to be problematic in udig, and we have been ignoring it, because our authority factory is actually returning the wrong answers.

P

simone giannecchini wrote:

Hi List,
lately I have been messing around with projection and coordinate
reference systems and I found these topics somehow foggy.
A couple of issues were killing me:

1>While I was writing the GeoTiffWriter I was using the epsg-access
because I needed a complete set of factories for datum, cs etc...
Everything seemed to be working just fine until we plugged a beta
version of the plugin inside the WCS that me and Alessio are
developing exploiting GeoServer structure. Well once you expose a map
which mixes features from shapefiles and a geotiff grom a GridCoverage
the map gets turned upside down! That killed me so we decided to stop
the development of the GeoTiffWriter to dig a bit the problem, but due
to laking of time I have to give up to work on other things.

If someone is interested what the WMS does with GridCoverages is to
ask the WCS which just wraps them inside a feature.

2>While writing some code for reprojecting to WGS84 some images that
originally were in Standard Mercator, I ran into this problem again
since I was mixing code from a WKT string found in the espg-wkt text
with some code using epsg-access.

I solved it just switching the axes as Martin suggested me, and the
image came up turned just fine, even if nothing raelly happened, like
the reprojection had not been done!

This brings up two questions:
1>Is it my impression or the Standard Mercator 1 parallel projection
is not yeat supported in GeoTools? I think this since I get no errors
or exception but nothing happens. I hope someone can tell me somthing
or provide some code to do that.

2>Are epsg-access and epsg-wkt interchangeable? To check this latter issue a wrote a small piece of code as follows:

//getting a factory from epsg-access
        //and anotehr one from epsg-wkt
        CRSAuthorityFactory
crsFactoryWKT=FactoryFinder.getCRSAuthorityFactory("EPSG", new
Hints(Hints.CRS_AUTHORITY_FACTORY,EPSGCRSAuthorityFactory.class)),
            crsFactoryEPSG=FactoryFinder.getCRSAuthorityFactory("EPSG", new
Hints(Hints.CRS_AUTHORITY_FACTORY,DefaultFactory
.class));
        CoordinateReferenceSystem
crsWKT=crsFactoryWKT.createCoordinateReferenceSystem("EPSG:4326"),
            crsEPSG=crsFactoryEPSG.createCoordinateReferenceSystem("EPSG:4326");
        System.out.println("Are they equals?");
        System.out.println(crsEPSG.toWKT().equalsIgnoreCase(crsWKT.toWKT()));

        System.out.println("epsg version of wgs84"); System.out.println(crsEPSG.toWKT());
        System.out.println("");
               System.out.println("wkt version of wgs84"); System.out.println(crsWKT.toWKT());

Well surprisingly (at least for me :frowning: ) the result was the following:

Are they equals?
false
epsg
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, AUTHORITY["EPSG","106"]], AXIS["Geodetic longitude", EAST, AUTHORITY["EPSG","107"]], AUTHORITY["EPSG","4326"]]

wkt
GEOGCS["WGS 84", DATUM["WGS_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["Lon", EAST], AXIS["Lat", NORTH], AUTHORITY["EPSG","4326"]]

I strongly believe that the two descriptions should be almost the
same even if not completely equals, BUT HERE THE TWO AXES ARE
INVERTED!!!!
This explain the problems we have been experiencing in the WMS-WCS
side because of the fact that we were using epsg-access and epsg-wkt
at the same
time.

I really hope that someone can fix this up quickly, because this issue
(UNLESS IT IS ME MAKING A MISTAKE) is KILLING me!

Simone.

-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_idt12&alloc_id344&op=click
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel