Our application is huge. It is not straightforward to create a test example.  Let me respond to what you stated

> This is the problem!!! You should be passing in *3* then the check would pass!

How should I pass in 3?. All is done inside StreamingRenderer. It starts with
StreamingRenderer.paint
StreamingRenderer.processStylers
StreamingRenderer.drawPlain
StreamingRenderer.processFeature
StreamingRenderer.processSymbolizers
StreamingRenderer$RenderableFeature.getShape
StreamingRenderer$RenderableFeature.getTransformedShape
and then it calls
LiteCoordinateSequence.cloneGeometry
which then does inside this check and throws an exception.

Means, I do not pass anything. Inside this sequence it uses the CoordinateReferenceSystem which it gets from SymbolizerAssociation. This CoordinateReferenceSystem returns as dimension 2 which then is used in that check. So, I do not pass a 2. It is all done inside StreamingRenderer. The CoordinateReferenceSystemis is created by CRS.decode(code), again not my code. As it is a UTM projection the dimension is 2.

=>  when I create a 2-dimensional point -  new Coordinate(x,y) - all works fine.

=>  when I create a 3-dimensional point -  new Coordinate(x,y,z) - and I  do *NOT *load the features into memory;all works fine.

=>  when I create a 3-dimensional point -  new Coordinate(x,y,z) - and I  do load the points into memory -  DataUtilities.source( DataUtilities.collection(source.getFeatures())) - then the exception is throw as StreaminReader clones the geometry inside getTransformedShape.

There is a problem when the geometry gets cloned and when the Point is 3D but the CoordinateReferenceSystem is 2D. This did perfectly work in version 21.2. And it does *not *work in 25.2

Shouldn't that be enough information  to understand the problem.

Peter


Am 06.10.2021 um 18:09 schrieb Ian Turton:


On Wed, 6 Oct 2021 at 17:03, Peter Friess <pk.fri...@t-online.de <mailto:pk.fri...@t-online.de>> wrote:

    Sorry Ian,

    I don't get it. I create a Coordinate and pass 3 values:
    enh.getX(),enh.getY(), enh.getZ(). Why are you telling me I pass
    2? I also stated I check in the debugger the Coordinate has x, y,
    and z.


> The problem is that the CRS returns 2 as dimension, which is correct

This is the problem!!! You should be passing in *3* then the check would pass! At no point did I suggest you passed in two.

Please produce a small test case so we can all see what is happening.

Ian

    Peter


    Am 06.10.2021 um 17:52 schrieb Ian Turton:


    On Wed, 6 Oct 2021 at 16:35, Peter Friess <pk.fri...@t-online.de
    <mailto:pk.fri...@t-online.de>> wrote:

        Hi Ian

        My points have a dimension of 3, see below, or let me repeat
        here:

        gf.createPoint(new Coordinate(enh.getX(), enh.getY(), enh.getZ()

        My points have X,Y,Z. The problem is that the CRS returns 2
        as dimension, which is correct


    No that is the problem - your points have a dimension of 3 so you
    should not pass in 2 here. You could try calling
    
`org.geotools.geometry.jts.LiteCoordinateSequence.guessDimension(Coordinate...)`
    which should return 3 for your data.

        , but  in PackedCoordinateSequence it does this check
        (dimension - measures < 2) and this measures is 1. measures
        comes from my Point which contains XYZ (I checked in the
        debugger) when it gets converted to CoordinateSequence and
        this CoordinateSequence returns the 1 for the measures
        (cs.getMeasures()).

        I have no clue what that measures meansand why it is 1. I
        also do not understand why it is necessary to involve a CRS
        to get a dimension if a Point gets (just) cloned.


    measures are the M of a POINTMZ or POINTM (so yet another
    dimension to the coordinate) - you should get 3-1 = 2 (x,y) and
    all should be well.

        Yes, it is a show stopper. What I want to try is, use
        jts-1.11 instead of jts-1.18. Not sure if that is compatible
        with Geotools 25.2. It is also not clear to me, who is
        responsible for jts. Is it the Geotools team, or some other team.


    It looks like it is a geotools problem, so as a first step raise
    an issue
    (https://osgeo-org.atlassian.net/jira/software/c/projects/GEOT
    <https://osgeo-org.atlassian.net/jira/software/c/projects/GEOT>)
    preferably with a test case. Then either wait for a fix to come,
    or implement a fix or incentivise someone to care about it for you.

    Ian

-- Ian Turton



--
Ian Turton
_______________________________________________
GeoTools-GT2-Users mailing list
GeoTools-GT2-Users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to