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 ) 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.