postgis-java icon indicating copy to clipboard operation
postgis-java copied to clipboard

postgis binary writer does not support jts m-dimension

Open TimPigden opened this issue 11 months ago • 1 comments

This method:

    public static final int getCoordSequenceDim(CoordinateSequence coords) {
        if (coords == null || coords.size() == 0)
            return 0;
        // JTS has a really strange way to handle dimensions!
        // Just have a look at PackedCoordinateSequence and
        // CoordinateArraySequence
        int dimensions = coords.getDimension();
        if (dimensions == 3) {
            // CoordinateArraySequence will always return 3, so we have to
            // check, if
            // the third ordinate contains NaN, then the geom is actually
            // 2-dimensional
            return Double.isNaN(coords.getOrdinate(0, CoordinateSequence.Z)) ? 2 : 3;
        } else {
            return dimensions;
        }
    }

will check for a Z dimension but not the M dimension which is used, for example, in pgMapMatching Nothing in here has changed inyears. What's the status if i do a pull request?

TimPigden avatar Jan 27 '25 16:01 TimPigden