Skip to content

esrijson to geojson Exception #321

@handsomeCLF

Description

@handsomeCLF

I have an esrijson and when converting it to geojson, I found that the geometry returned by createGeometryByGeoJson is empty. Is there any other way to convert it to geojson?
I can successfully convert using https://github.com/Esri/arcgis-to-geojson-utils arcgisToGeoJSON method.

The code example is as follows:

public String EsriJsonToGeoJson(String esri_json){
    Geometry geometry = createGeometryByJson(esri_json);
    return getGeoJson(geometry);
}

private Geometry createGeometryByGeoJson(String geojson) {
    return GeometryEngine.geoJsonToGeometry(geojson, WktExportFlags.wktExportDefaults, Geometry.Type.Unknown).getGeometry();
}

private String getGeoJson(Geometry geometry) {
    return GeometryEngine.geometryToGeoJson(geometry);
}

The data example is as follows:
GeoJson.json

EsriJson.json

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions