Screenshot instructions:
Windows
Mac
Red Hat Linux
Ubuntu
Click URL instructions:
Rightclick on ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)
From: Adrian Custer <acuster@gm...>  20060725 09:27:01

Hey all, I've been working on the 'Georeferencing' chapter for the user manual. I've gotten a long way towards an outline, something like: Background: Overview: CRS's and Operations Warnings: 2d only/ axis order issue/ Spatial error size Resources: Standards / Literature / Web Code: Layout / Packaging / FactorySystem+GeoAPI / premade Essential Geodesy: DirectPositions are... Datums: benchmarks, geoid, ITerrestrialRefFrame, ICelestialRF The Class Hierarchy: Units: JSR108 vs. JSR275 (JScience) Parameter: Identified Object: Datum: anchor point? / ellipsoid / prime meridian Coord Sys: axis / CS CRS: DirectPosition: CoordOperation: ... Tutorials: CRS Tutorial (a formalized version of CRSTutorial.java) CoordOp Tutorial ( the second half of CRSTutorial.java) Test Apps: Concoqt  Create a DirectPosition Reproject  Display a dataset (shapefile), then reproject which seems like it's a good basis for the docs to help users understand what's going on. However, I need some help on the issues below. Math Notation:  EPSG uses the notation of JPSnyder's "Map Projections  A working manual". Is this what Geotools uses as well? Is there any place where the equations which are used are presented? I'm especially interested in how the dimension reduction happens going from a geocentered XYZ coordinate to the geographic 2D. Does this happen by defining special matrices to augment/diminish the dimension? Stuck on CoordinateOperations:  I'm really stuck on CoordinateOperations since I can't get traction to get started and learn from there. Unfortunately, I don't understand enough to ask my question coherently so, when i say nonsensical things, you'll have to guess between my lines. Which operations are supported? EPSG tech note 7 part 1 page 11 has a diagram of the general case of different CRS's and the steps to convert between them. Since GT2.2.x only has 2D DirectPositions, persumably GT has operations only for a subset of that diagram. (1) What subset of that diagram does Gt perform? Only the coordinate operations which are actually 2D > 2D? (2) Transforms seem to go through earth centered cartesian coordinates but is this, for GT2.2.x, actually geographic2D > geocentric (point on ellipsoid surface) > geographic2D? Does this happen only for BursaWolf transforms? How to create / obtain coordinate operations? >From the CRSTutorial and javadocs, it's easy to create a 'transform' that goes from CRS to CRS. (1) is this possible for any CRS in the EPSG database and any user defined CRS that has a complete toWGS84 information? How do we get operations from Geotools? (1) The CRSTutorial.java has the following: MathTransformFactory mtFactory = FactoryFinder.getMathTransformFactory(null); ParameterValueGroup params = mtFactory.getDefaultParameters("Hotine_Oblique_Mercator"); where do we get a list of valid string parameters to get prenamed parameter groups? Are these pulled from the EPSG database or from some Geotools class? (2) Are there static, premade CoordinateOperations? How do I create coordinate operations by hand? I'm interested in creating a conversion, a conversion which is a projection, and a transformation. (1) The CRSTutorial.java has the following: MathTransformFactory mtFactory = FactoryFinder.getMathTransformFactory(null); ParameterValueGroup params = mtFactory.getDefaultParameters("Hotine_Oblique_Mercator"); Where does the magic string value come from, and where are others defined? (2) For each operation (perhaps specifically projection) like that above, where does Gt2 define the parameters that are in the group? (3) Can I get operations from the EPSG database, as in the currently not working: CoordinateOperationAuthorityFactory coaf = FactoryFinder.getCoordinateOperationAuthorityFactory("EPSG",null); CoordinateOperation co = coaf.createCoordinateOperation(""); //TODO find an operation code Thanks for any answers or pointers to get me unstuck, adrian 
From: Martin Desruisseaux <martin.desruisseaux@ge...>  20060807 14:19:04

Hello all I'm back on the mailing list, but it will take a while before I become up= to date with the ~300=20 geotools emails... Adrian Custer a =E9crit : > I've been working on the 'Georeferencing' chapter for the user manual. Cool!!!! Thanks a lot for doing that. > I've gotten a long way towards an outline, something like: >=20 > Background: > Overview: CRS's and Operations > Warnings: 2d only/ axis order issue/ Spatial error size > Resources: Standards / Literature / Web > Code: Layout / Packaging / FactorySystem+GeoAPI / > premade Note: The referencing module (as well as GeoAPI interfaces) are not 2D on= ly. They can be 3D and 4D=20 as well, with Z and time axis. What is not yet fully implemented is "elli= psoidal to geoidal height=20 conversions". There is some partial work in the recently added referencin= g3D module, but this is not=20 yet completed. However, some other kinds of 3D conversions like "ellipsoi= dal (lat,long,height) to=20 geocentric (X,Y,Z)" already work. Time axis also work (at least a minimal= time support  it could be=20 more elaborated). > The Class Hierarchy: > Units: JSR108 vs. JSR275 (JScience) Note that JSR275 is an evolution of JSR108. Both of them were mostly wr= itten by the same author=20 (JeanMarie Dautelle). We will also replace JSR108 by JSR275, so it may= not be worth to put too=20 much emphasis about JSR108 (which is officially dead anyway). One issue = we may face is that JSR275=20 target Java 1.5 (but a port to Java 1.4 would probably be possible if Jav= a 1.5 still a blocker issue=20 for Geotools). > Math Notation: >  > EPSG uses the notation of JPSnyder's "Map Projections  A working > manual". Is this what Geotools uses as well?=20 If we are talking about the projection code in the=20 org.geotools.referencing.operation.projection.MapProjection class and sub= classes, Rueben Schulz is=20 the best person who can answer this. But I believe that the code is close= the Snyder's notation at=20 least for local variable. But the protected fields in MapProjection has b= een renamed (since they=20 appears in the javadoc) with more explicit names. For example "a" and "b"= have been renamed as=20 "semiMajor" and "semiMinor". However, the javadoc give the Synder names. = Example: http://javadoc.geotools.fr/snapshot/org/geotools/referencing/operation/pr= ojection/MapProjection.html#semiMajor > Is there any place where the equations which are used are presented? I'= m > especially interested in how the dimension reduction happens going from > a geocentered XYZ coordinate to the geographic 2D. Does this happen by > defining special matrices to augment/diminish the dimension? The equation are not documented  we need to check in the source code, wh= ich is not really=20 convenient. However, again Rueben Schulz is probably the best contact per= son for topic related to=20 projection equation. However, in the specific case of XYZ to geographic 2D mapping, this issue= is outside the scope of=20 projection. It is rather implemented in the org.geotools.referencing.oper= ation.transform.Geocentric=20 class. There is the rule:  Geocentric (X,Y,Z) <> Geographic 3D (latitude,longitude,height) w= here "height" is height above the ellipsoid (not height above the geoid) are implemen= ted and should work accuratly. Important: this will work only if the GeographicCRS = uses a 3D EllipsoidCS, not a CompoundCRS with a 2DGeographicCRS and a Vertica= lCRS. In a 3D EllipsoidCS, the height is always the height above the ellipsoid  i= t can't be any other kind of height.  Geocentric (X,Y,Z) <> Geographic 2D (latitude,longitude) work as = in previous point (> Geographic 3D), but drops the height *after* the computation (s= o the height were taken in account for latitude,longitude computation).  Geocentric (X,Y,Z) <> Geographic 3D (latitude,longitude,height) w= here "height" is height above the *geoid*: the "Geographic 3D" is actually an instanc= e of CompoundCRS made of a 2DGeographicCRS with a VerticalCRS, where the VerticalDat= umType is VerticalDatumType.GEOIDAL. Geotools should apply the following trans= formation chain: Geocentric (X,Y,Z) <> Geographic 3D (latitude,longitude,height ab= ove the ellipsoid) <> Geographic 3D (latitude,longitude,heigth above the geoid) This is only the last step which is not yet fully implemented in geo= tools (the "height above the ellipsoid" <> "height above the geoid" transform). It is= partially implemented in the referencing3D module, but the work is not finished. However t= he first transformation step (Geocentric <> Geographic 3D with height above the ellipsoid)= is fully implemented. > EPSG tech note 7 part 1 page 11 has a diagram of the general case of > different CRS's and the steps to convert between them. Since GT2.2.x > only has 2D DirectPositions, persumably GT has operations only for a > subset of that diagram.=20 Geotools 2.3 (and 2.2 too I believe) has GeneralDirectPosition, which is = nD. > (1) What subset of that diagram does Gt perform? Only the > coordinate operations which are actually 2D > 2D? No. Geotools is really nD, as long as the height is "height above the ell= ipsoid". Other kind of=20 heights are not fully implemented. The question is not really "which coordinate operations are implemented",= but "which coordinate=20 operation *methods* are implemented" (i.e. not CoordinateOperation, but C= oordinateOperationMethod=20 object). A list of the later is available. Try to enter the following ins= truction from the command line: java org.geotools.referencing.operation.DefaultMathTransformFactory Note: if you are on windows, try the following: java org.geotools.referencing.operation.DefaultMathTransformFactory enco= ding Cp850 Where "Cp850" is actually the output of the "chcp" DOS command. This enc= oding Cp850 argument need=20 to specified only once; Geotools will remember it. The above should display a list of all available operation method. Make s= ure that yours DOS command=20 windows is large enough (something like 120 characters). The exact output= depends on the plugin in=20 the classpath. For example, you should have one more method is "plugin/re= ferencing3D" is in the=20 classpath. In order to get more information about a specific operation method, give = this operation method in=20 argument. Example: java org.geotools.referencing.operation.DefaultMathTransformFactory Merca= tor > (2) Transforms seem to go through earth centered cartesian > coordinates but is this, for GT2.2.x, actually=20 > geographic2D > geocentric (point on ellipsoid surface) > > geographic2D? Does this happen only for BursaWolf transforms? Close but not exactly. There is at least 3 different way to use BursaWol= f parameters: using=20 "Molodenski" transform, "Abridged Molodenski" and "Geographic to geocentr= ic" method. It pass through=20 Geocentric CRS for datum shift using the later methods. For the two forme= r (using "Molodenski"), the=20 transformation is applied directly on the geographic CRS without passing = through Geocentric, but=20 with a slight loose of precision. Lets say that conceptually, BuraWolf parameters are always applied on Ge= ocentric CRS (so a=20 Geographic to Geocentric transform is applied automatically when necessar= y), but the "Molodenski"=20 transform is a shortcut allowing to apply the transformation directly on = Geographic CRS, without the=20 "Geographic to Geocentric" step, at the cost of a small accuracy lost. > How to create / obtain coordinate operations? >=20 >>From the CRSTutorial and javadocs, it's easy to create a 'transform' > that goes from CRS to CRS.=20 > (1) is this possible for any CRS in the EPSG database and any > user defined CRS that has a complete toWGS84 information? It is possible as long as the CoordinateOperationMethod is known to Geoto= ols (ie. is in the list of=20 CoordinateOperationMethod shown by the abovecited java command). If the = CoordinateOperationMethod=20 is a known one, then it should work with userspecified CRS as well. In TOWGS84 information is not required in all case  only when the datum = are not the same. If the=20 datum are identical (where "identical" means having the same name or at l= east one), then there is no=20 need for TOWGS84 (and it is actually ignored). One additional note: there is a problem about detecting if two datum name= are actually for the same=20 datum. Different softwares may use different name for the same datum. For= this reason, Geotools has=20 a list of aliases: http://svn.geotools.org/geotools/trunk/gt/module/referencing/src/org/geot= ools/referencing/factory/DatumAliasesTable.txt > How do we get operations from Geotools? >=20 > (1) The CRSTutorial.java has the following: > MathTransformFactory mtFactory =3D=20 > FactoryFinder.getMathTransformFactory(null); > ParameterValueGroup params =3D > mtFactory.getDefaultParameters("Hotine_Oblique_Mercator"); > where do we get a list of valid string parameters to get > prenamed parameter groups? Are these pulled from the EPSG > database or from some Geotools class? The parameters list can be obtained from the console using the abovecite= d "java" command. They can=20 also be obtained programmatically using the ParameterDescriptorGroup API.= From memory (I don't have=20 the API at hand right now): descriptor =3D params.getDescriptor(); List l =3D descriptor.getParameterList(); // or something like that > (2) Are there static, premade CoordinateOperations? The available parameter for each CoordinateOperationMethod are static, bu= ild in the Java code of the=20 coordinate operation method implementation. However the coordinate operat= ion parameter *value* are=20 fetch from the EPSG database. > How do I create coordinate operations by hand?=20 >=20 > I'm interested in creating a conversion, a conversion which is = a > projection, and a transformation.=20 > =20 > (1) The CRSTutorial.java has the following: > MathTransformFactory mtFactory =3D=20 > FactoryFinder.getMathTransformFactory(null); > ParameterValueGroup params =3D > mtFactory.getDefaultParameters("Hotine_Oblique_Mercator"); > Where does the magic string value come from, and where are > others defined? MathTransformFactory.getOperationMethods(); // from memory, something lik= e that. This is the list displayed by "java org..." above. This list is constructed from the class found in=20 METAINF/services/org.geotools.referencing.operation.MathTransformProvide= r. The main ones are: http://svn.geotools.org/geotools/trunk/gt/module/referencing/src/METAINF= /services/org.geotools.referencing.operation.MathTransformProvider > (2) For each operation (perhaps specifically projection) like > that above, where does Gt2 define the parameters that are in th= e > group? The parameter (not the value, just the parameter definition) are hardcod= ed in the class=20 implementing the specific projection. In Geotools implementation, they ar= e almost always implemented=20 in a "Provider" inner class, in a "PARAMETERS" field. Example: http://svn.geotools.org/geotools/trunk/gt/module/referencing/src/org/geot= ools/referencing/operation/projection/PlateCarree.java Parameters descriptors are hardcoded because the projection algorithm (i= .e. the formluas) is=20 hardcoded anyway, as Java code. > =20 > (3) Can I get operations from the EPSG database, as in the > currently not working: > CoordinateOperationAuthorityFactory coaf =3D > FactoryFinder.getCoordinateOperationAuthorityFactory("EPSG",nul= l); > CoordinateOperation co =3D > coaf.createCoordinateOperation(""); > //TODO find an operation code Try (note sure about the method name): List<String> codes =3D coaf.getAuthorityCodes(CoordinateOperationMeth= od.class); for (String code : codes) { String description =3D coaef.getDescription(code); System.out.println(description); } Martin. 