We actually ran into a similar problem last year with 2D rendering.
We put a special case in the renderer to go from 3D to 2D (it is a 2D
renderer). What it would do (if required) was translate to "any 3d" to
WGS84-3D. Then it would drop the coordinates to make it WGS84-2D and then
finally transform into the requested 2D space for drawing.
So if you had a 3D renderer it could take similar steps (doing your height
look up in place of dropping the coordinates above).
--
Jody
Jody Garnett
On Wed, Jun 25, 2014 at 12:58 AM, Eric W. Anderson <ander...@cs.cmu.edu>
wrote:
> So, I figured out what's going on in my particular case, and I could
> relatively-cleanly add a "Elevation Provider" to supply Z dimension info,
> and
> an Elevation Provider Factory to supply it, and put support for that into
> ReferencingFactoryFinder.
>
> The question then becomes: Where would you want the logic for "when should
> GeoTools try to use this" go? Right now, GeoTools' default logic (in
> DefaultCoordinateOperationFactory) seems to be happy as a clam until it
> tries
> to SwapAndScaleAxis from a 2D CS to a 3D CS, and then it borks. I could
> special-case this particular logic, but I have to imagine the "I want to do
> 2D->3D" case could come up in other paths, too. Any suggestions?
>
> Thanks,
> Eric
>
> Thus spake Jody Garnett (jody.garn...@gmail.com):
>
> > Nice turtles all the way down reference.
> > I figured this out once for a change request, it has diagrams if that
> > helps you find your way:
> > [1]
> http://docs.codehaus.org/display/GEOTOOLS/Improve+CRSAuthority+Concurrency+Caching+and+Connection+Use
> > The indirection is mostly caused by a "need for speed" - they can be
> > expensive to create so we cache everything we can with weak
> references,
> > but that was not good enough so we hard reference the most popular 10
> or
> > something ...
> > I did not look carefully at MathTransformFactory use, I would
> recommend
> > stepping through with a debugger (a great way to figure things out
> when
> > there is this much setup and indirection involved). Note some of the
> other
> > CoordinateReferenceSystems end up being backed by their own large
> datasets
> > (Grid Shift files). I have never registered an additional
> MathTransform
> > myself, but the design does allow for it.
> > Jody Garnett
> >
> > On Tue, Jun 24, 2014 at 1:38 AM, Eric W. Anderson <[2]
> ander...@cs.cmu.edu>
> > wrote:
> >
> > Hi All,
> >
> > Thanks for the help. I looked at this a bit, and I'm trying to
> figure
> > out
> > exactly what's going on. There seems to be a nearly-endless chain
> of
> > indirection here, looking for providers of implementations of pools
> of
> > registries of sets of plugins of finders of factories of ...
> >
> > Is there somewhere -- either in the code or the documentation --
> where
> > the
> > logic of "how to find or construct a transform from coordinate
> system A
> > to
> > coordinate system B" is located, or is it turtles all the way down?
> > DefaultCoordinateOperationFactory is the closest thing I've found.
> >
> > Thanks,
> > Eric
> >
> > Thus spake Jody Garnett ([3]jody.garn...@gmail.com):
> > > There is a bunch of factories for this stuff:
> > >
> > [1][4]
> http://docs.geotools.org/latest/userguide/library/referencing/internal.html
> > > I am used to handling this as a geometry processing task in
> other
> > systems
> > > (rather than a math transform)....
> > > i.e. use either a process or a function that geometry in and a
> DEM
> > in, and
> > > "Drapes" the geometry over the DEM returning a new geometry.
> > >
> > - [2][5]
> http://docs.geotools.org/latest/userguide/tutorial/function.html
> > >
> > - [3][6]
> http://docs.geotools.org/latest/userguide/tutorial/process.html
> > > Those are worth going over anyways as they introduce how
> geotools
> > > factories work.
> > > --
> > > Jody Garnett
> > >
> > > On Wed, Jun 18, 2014 at 4:06 AM, Eric W. Anderson
> > <[4][7]ander...@cs.cmu.edu>
> > > wrote:
> > >
> > > What would I have to do to add this? Or, put slightly
> > differently,
> > > what's the
> > > current process by which findMathTransform() looks for
> > conversions, and
> > > how can
> > > I tell it about a new one?
> > >
> > > (I know I could just hack in some code to do what I want, but
> > that would
> > > be
> > > ugly.)
> > >
> > > Thanks,
> > > Eric
> > >
> > > Thus spake Andrea Aime ([5][8]andrea.a...@geo-solutions.it):
> > > > On Fri, Jun 13, 2014 at 10:36 PM, Eric W. Anderson
> > > > <[1][6][9]ander...@cs.cmu.edu> wrote:
> > > >
> > > > Hi All,
> > > >
> > > > I'm using Geotools, and I need to convert coordinates
> > between 2D
> > > and 3D
> > > > coordinate reference systems. I recognize that
> there's no
> > > > universally-correct way to do this: 2D -> 3D means
> "making
> > up" a
> > > Z
> > > > coordinate, and 3D -> 2D means losing information.
> But, is
> > there
> > > some
> > > > way to teach Geotools that, in my particular context,
> I
> > want to
> > > use a
> > > > specific transformation. E.g.:
> > > >
> > > > +-----+ +-----+
> > > > | | --- Z = 15 ---> | |
> > > > | 2D | | 3D |
> > > > | | <-- drop Z ---- | |
> > > > +-----+ +-----+
> > > > I know I can transform any particular coordinate
> manually
> > this
> > > way, but
> > > > I'd like to integrate it so this Just Works. e.g. I
> can do
> > > > CRS.findMathTranform(a, b) and if a is convertible to
> my
> > 2D CRS,
> > > and my
> > > > 3D CRS is convertible to b, it works.
> > > >
> > > > No. The 3D -> 2D path is normally supported, but the 2D
> ->
> > 3D never
> > > is as
> > > > far as I remember.
> > > > That said, if all you want is adding an extra static
> > ordinate, it
> > > should
> > > > not be too hard to do it yourself.
> > > > I guess it could be interesting to have some tooling in
> > geotools
> > > that
> > > > given a 2D geometry and a helper object, would add the
> 3rd
> > > ordinate, where
> > > > the helper might look like:
> > > > interface ElevationProvider() {
> > > > double getElevation(DirectPosition2D pos);
> > > > }
> > > > which then the client would implement in different ways,
> > e.g.,
> > > fixed
> > > > value, or DEM sampling.
> > > > As usual, it's a matter of one having enough
> time/funding to
> > > discuss the
> > > > evolution in the dev mailing list,
> > > > implement it, and merge it.
> > > > Cheers
> > > > Andrea
> > > >
> > > > --
> > > > ==
> > > > GeoServer Professional Services from the experts! Visit
> > > > [2][7][10]http://goo.gl/NWWaa2 for more information.
> > > > ==
> > > > Ing. Andrea Aime
> > > > @geowolf
> > > > Technical Lead
> > > > GeoSolutions S.A.S.
> > > > Via Poggio alle Viti 1187
> > > > 55054 Massarosa (LU)
> > > > Italy
> > > > phone: [8][11]+39 0584 962313
> > > > fax: [9][12]+39 0584 1660272
> > > > mob: [10][13]+39 339 8844549
> > > > [3][11][14]http://www.geo-solutions.it
> > > > [4][12][15]http://twitter.com/geosolutions_it
> > > > -------------------------------------------------------
> > > >
> > > > References
> > > >
> > > > Visible links
> > > > 1. mailto:[13][16]ander...@cs.cmu.edu
> > > > 2. [14][17]http://goo.gl/NWWaa2
> > > > 3. [15][18]http://www.geo-solutions.it/
> > > > 4. [16][19]http://twitter.com/geosolutions_it
> > > --
> > > Eric W. Anderson Computer Science
> > Department
> > > [17][20]ander...@cs.cmu.edu
> Carnegie
> > Mellon
> > > University
> > > phone: [18][21]+1-412-268-1908
> > Gates-Hillmann Center
> > > 6005
> > >
> > > PGP key fingerprint:
> > > D3C5 D6FF EDED 9F1F C36D 53A3 74B7 53A6 3C74 5F12
> > >
> >
>
> ------------------------------------------------------------------------------
> > > HPCC Systems Open Source Big Data Platform from LexisNexis
> Risk
> > > Solutions
> > > Find What Matters Most in Your Big Data with HPCC Systems
> > > Open Source. Fast. Scalable. Simple. Ideal for Dirty Data.
> > > Leverages Graph Analysis for Fast Processing & Easy Data
> > Exploration
> > > [19][22]http://p.sf.net/sfu/hpccsystems
> > > _______________________________________________
> > > GeoTools-GT2-Users mailing list
> > > [20][23]GeoTools-GT2-Users@lists.sourceforge.net
> > >
> > [21][24]
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > >
> > > References
> > >
> > > Visible links
> > > 1.
> > [25]
> http://docs.geotools.org/latest/userguide/library/referencing/internal.html
> > > 2.
> > [26]
> http://docs.geotools.org/latest/userguide/tutorial/function.html
> > > 3.
> > [27]http://docs.geotools.org/latest/userguide/tutorial/process.html
> > > 4. mailto:[28]ander...@cs.cmu.edu
> > > 5. mailto:[29]andrea.a...@geo-solutions.it
> > > 6. mailto:[30]ander...@cs.cmu.edu
> > > 7. [31]http://goo.gl/NWWaa2
> > > 8. file:///tmp/tel:%2B39%200584%20962313
> > > 9. file:///tmp/tel:%2B39%200584%201660272
> > > 10. file:///tmp/tel:%2B39%20%C2%A0339%208844549
> > > 11. [32]http://www.geo-solutions.it/
> > > 12. [33]http://twitter.com/geosolutions_it
> > > 13. mailto:[34]ander...@cs.cmu.edu
> > > 14. [35]http://goo.gl/NWWaa2
> > > 15. [36]http://www.geo-solutions.it/
> > > 16. [37]http://twitter.com/geosolutions_it
> > > 17. mailto:[38]ander...@cs.cmu.edu
> > > 18. file:///tmp/tel:%2B1-412-268-1908
> > > 19. [39]http://p.sf.net/sfu/hpccsystems
> > > 20. mailto:[40]GeoTools-GT2-Users@lists.sourceforge.net
> > > 21.
> > [41]https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > --
> > Eric W. Anderson Computer Science
> Department
> > [42]ander...@cs.cmu.edu Carnegie Mellon
> > University
> > phone: [43]+1-412-268-1908 Gates-Hillmann
> Center
> > 6005
> >
> > PGP key fingerprint:
> > D3C5 D6FF EDED 9F1F C36D 53A3 74B7 53A6 3C74 5F12
> >
> > References
> >
> > Visible links
> > 1.
> http://docs.codehaus.org/display/GEOTOOLS/Improve+CRSAuthority+Concurrency+Caching+and+Connection+Use
> > 2. mailto:ander...@cs.cmu.edu
> > 3. mailto:jody.garn...@gmail.com
> > 4.
> http://docs.geotools.org/latest/userguide/library/referencing/internal.html
> > 5. http://docs.geotools.org/latest/userguide/tutorial/function.html
> > 6. http://docs.geotools.org/latest/userguide/tutorial/process.html
> > 7. mailto:ander...@cs.cmu.edu
> > 8. mailto:andrea.a...@geo-solutions.it
> > 9. mailto:ander...@cs.cmu.edu
> > 10. http://goo.gl/NWWaa2
> > 11. file:///tmp/tel:%2B39%200584%20962313
> > 12. file:///tmp/tel:%2B39%200584%201660272
> > 13. file:///tmp/tel:%2B39%20%C2%A0339%208844549
> > 14. http://www.geo-solutions.it/
> > 15. http://twitter.com/geosolutions_it
> > 16. mailto:ander...@cs.cmu.edu
> > 17. http://goo.gl/NWWaa2
> > 18. http://www.geo-solutions.it/
> > 19. http://twitter.com/geosolutions_it
> > 20. mailto:ander...@cs.cmu.edu
> > 21. file:///tmp/tel:%2B1-412-268-1908
> > 22. http://p.sf.net/sfu/hpccsystems
> > 23. mailto:GeoTools-GT2-Users@lists.sourceforge.net
> > 24. https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > 25.
> http://docs.geotools.org/latest/userguide/library/referencing/internal.html
> > 26. http://docs.geotools.org/latest/userguide/tutorial/function.html
> > 27. http://docs.geotools.org/latest/userguide/tutorial/process.html
> > 28. mailto:ander...@cs.cmu.edu
> > 29. mailto:andrea.a...@geo-solutions.it
> > 30. mailto:ander...@cs.cmu.edu
> > 31. http://goo.gl/NWWaa2
> > 32. http://www.geo-solutions.it/
> > 33. http://twitter.com/geosolutions_it
> > 34. mailto:ander...@cs.cmu.edu
> > 35. http://goo.gl/NWWaa2
> > 36. http://www.geo-solutions.it/
> > 37. http://twitter.com/geosolutions_it
> > 38. mailto:ander...@cs.cmu.edu
> > 39. http://p.sf.net/sfu/hpccsystems
> > 40. mailto:GeoTools-GT2-Users@lists.sourceforge.net
> > 41. https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
> > 42. mailto:ander...@cs.cmu.edu
> > 43. file:///tmp/tel:%2B1-412-268-1908
>
> --
> Eric W. Anderson Computer Science Department
> ander...@cs.cmu.edu Carnegie Mellon University
> phone: +1-412-268-1908 Gates-Hillmann Center 6005
>
> PGP key fingerprint:
> D3C5 D6FF EDED 9F1F C36D 53A3 74B7 53A6 3C74 5F12
>
------------------------------------------------------------------------------
Open source business process management suite built on Java and Eclipse
Turn processes into business applications with Bonita BPM Community Edition
Quickly connect people, data, and systems into organized workflows
Winner of BOSSIE, CODIE, OW2 and Gartner awards
http://p.sf.net/sfu/Bonitasoft
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users