TransWikia.com

How to add support for derivedCRSType in GeoTools?

Geographic Information Systems Asked on March 9, 2021

I am trying to parse some GeoJSON files using GeoTools (24.2). The file contains non-EPSG CRS references like urn:ogc:def:derivedCRSType:OGC:1.0:image which causes my parsing to fail. I am using the typical gt-epsg-hsql but it doesn’t seem to include that sort of CRS. Is there a jar file I could add to add support to this?

On the other hand I don’t really make use of that CRS, the file contains a point with geographical coordinates and another one with image coordinates. If there is a way to just ignore that property that’s equally fine with me.

Edit:
Here is an example feature (redacted as it’s not my property)

        {
        "type": "Feature",
        "geometry": {
            "type": "Point",
            "coordinates": [
                6.835789963766803,
                53.46926328556648
            ]
        },
        "properties": {
            "xxxxx": {
                "result": {
                    "yyyy": "xxx",
                    "zzzz": "jjjjj",
                    "position": {
                        "type": "Point",
                        "coordinates": [
                            6.835789963766803,
                            53.46926328556648
                        ],
                        "crs": {
                            "type": "name",
                            "properties": {
                                "name": "urn:ogc:def:crs:EPSG:4326"
                            }
                        }
                    },
                    "image_position": {
                        "type": "Point",
                        "coordinates": [
                            22310.318371607515,
                            243069.73173277662
                        ],
                        "crs": {
                            "type": "name",
                            "properties": {
                                "name": "urn:ogc:def:derivedCRSType:OGC:1.0:image"
                            }
                        }
                    },
                    "detection_time": "2021-02-28T05:41:52.644086",
                }
            }
        }
    }

I also need to add that even without the image CRS it still fails, looks like GeoTools cannot parse properties that are not simple dictionaries of values?

Edit 2:

Here is some code, it’s very simple though:

    FeatureJSON featureJSON = new FeatureJSON();
    FeatureCollection featureCollection = featureJSON.readFeatureCollection(new FileInputStream(geojsonpath));

The returned feature collection is empty but the geojson has features.

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP