[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[udig-devel] Re: First (of many) reproject question
|
Jody Garnett a écrit :
In short I am getting very different results from the Postgis
transformation code - I am sure we went over this
back in the spring. I recall at the end of the day we got both systems
returning with in 10cm of each other so
I am probably doing something wrong. The epsg.properties file being used
was generated from PostGIS so
the WKT definitions they are working from should be identical.
Now the answer may be one of:
0) I messed up
1) Switch over to the CRS system
2) The old CS objects no longer work, or parse WKT differently
4) The epsg.properties file is some how wrong
They were no significant changes in the old CS objects as far as I know.
I don't know why the result is different; I would need to investigate
it, but would prefer to debug the new CRS framework instead of the old one.
I tested the first point of yours polygon using the new CRS framework,
and got a result in the expected range. Could you try the new CRS
framework please? You can test it from the command line (no Java code to
write). Please follow the instruction below:
Run the following from a DOS command line:
java -ea org.geotools.referencing.Console
The program will wait for input from the standard input stream (i.e. the
keyboard). Cut-and-paste the lines in the attached file (example.txt) to
the DOS command line, one line at time so you can see the output (when
there is one). Note: the first two lines (SET statements) are
cut-and-paste from the 'epsg.properties' file, with only "SET" added in
front of them.
After the "source pt = 1187128,395268" instruction, I get the following
target pt:
-123.47009555832284, 48.54326156200811
which looks like the expected result.
If I messed up on this one I really would like to fix things as soon as
possible because all DataStores, Lite renderer and UDIG
are funneling through the CRSService API. It may be that CRSService
wants to go and live next to all the other CRS code,
it operates as a Facade for that module after all....
We will try to move CRS service in the CRS module. There is some step to
follow for that:
1) Port the CRS authority factories based on WKT property file;
Rueben was volonter for that.
2) Port CRSService itself. Some functionalities of this class may be
dispatched in more than one class, especially various CRS factory
interfaces and ISO 19107 (geometries) methods. For example the two
following methods:
CRSService.reproject(sourceCRS, targetCRS);
CRSService.transform(Polygon, MathTransform);
can be replaced by the following ISO 19107 method:
Geometry.transform(targetCRS);
See:
http://geoapi.sourceforge.net/snapshot/javadoc/org/opengis/spatialschema/geometry/Geometry.html#transform(org.opengis.referencing.crs.CoordinateReferenceSystem)
As soon as we can, we should abandon JTS in favor of ISO 19107 objects
(actually, wraps JTS objects into ISO 19107 wrappers), in which case the
above service will be available and replace the two above-cited methods
in CRSService. Those CRSService methods are actually workaround for JTS
not knowing what CRS and transformations are.
Note that a guy in our laboratory is just starting to look for wrapping
JTS in ISO 19107 objects. But it will take a while before it is ready...
Martin.
SET 42102=PROJCS["BC_Albers",GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",TOWGS84[0,0,0,0,0,0,0],SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]],PROJECTION["Albers_Conic_Equal_Area"],PARAMETER["False_Easting",1000000],PARAMETER["False_Northing",0],PARAMETER["Central_Meridian",-126],PARAMETER["Standard_Parallel_1",50],PARAMETER["Standard_Parallel_2",58.5],PARAMETER["Latitude_Of_Origin",45],UNIT["Meter",1]]
SET 4269=GEOGCS["GCS_North_American_1983",DATUM["D_North_American_1983",TOWGS84[0,0,0,0,0,0,0],SPHEROID["GRS_1980",6378137,298.257222101]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
source crs = 42102
target crs = 4269
status
source pt = 1187128,395268