Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CreateGeometryFromEsriJson Doesn't Support Arcs and Curves #9418

Open
achapkowski opened this issue Mar 7, 2024 · 6 comments
Open

CreateGeometryFromEsriJson Doesn't Support Arcs and Curves #9418

achapkowski opened this issue Mar 7, 2024 · 6 comments

Comments

@achapkowski
Copy link

What is the bug?

gdal doesn't export the EsriJSON to the proper curve geometries. See: https://gdal.org/development/rfc/rfc49_curve_geometries.html

When using the CreateGeometryFromEsriJson method and passing in the path and curve objects, the result is always None.

Steps to reproduce the issue

g_polygon:dict = {
  "hasM":true,
  "curveRings": [
    [
      [11, 11, 1],
      [10, 10, 2],
      [10, 11, 3],
      [11, 11, 4],
      {
        "b": [
          [15, 15, 2],
          [10, 17],
          [18, 20]
        ]
      },
      [11, 11, 4]
    ],
    [
      [15, 15, 1],
      {
        "c": [
          [20, 16, 3],
          [20, 14]
        ]
      },
      [15, 15, 3]
    ]
  ],
  "rings":[
    [
      [11, 11, 1],
      [10, 10, 2],
      [10, 11, 3],
      [11, 11, 4]
    ],
    [
      [15, 15, 1],
      [11, 11, 2],
      [12, 15.5],
      [15.4, 17.3],
      [15, 15, 3]
    ],
    [
      [20, 16 ,1],
      [20, 14],
      [17.6, 12.5],
      [15, 15, 2],
      [20, 16, 3]
    ]
  ]
}
g_curve_path:dict = {
  "curvePaths": [
    [
      [6,3],
      [5,3],
      {
        "b": [
          [3, 2],
          [6, 1],
          [2, 4]
        ]
      },
      [1, 2],
      {
        "a": [
          [0, 2],
          [0, 3],
        ]
      }
    ]
  ]
}

for geom in [g_curve_path, g_polygon]:
    ogr_geom = ogr.CreateGeometryFromEsriJson(json.dumps(geom))
    assert ogr_geom # always None

Versions and provenance

Version: '3.7.0e'
OS: Windows 10 Enterprise

Additional context

No response

@jratike80
Copy link
Collaborator

Maybe worth adding a note that non-linear geometries are not supported to the ESRIJSON driver documentation https://gdal.org/drivers/vector/esrijson.html. @achapkowski, could you have a try and create a pull request?

@achapkowski
Copy link
Author

@jratike80 ok, that can be done, but I think with the support of OGC curved geometries, it makes sense to support them.

@achapkowski
Copy link
Author

achapkowski commented Mar 7, 2024

@rouault here is the link to all the supported Esri JSON geometry formats: https://developers.arcgis.com/rest/services-reference/enterprise/geometry-objects.htm .

@jratike80
Copy link
Collaborator

I was just thinking that because GeoJSON and the OGC JSON-FG formats do not support curved geometries it may take some time to get the support into ESRIJSON driver. There is a proposal about adding the support into JSON-FG, though https://github.com/opengeospatial/ogc-feat-geo-json/blob/main/proposals/circular-geometry-objects.adoc.

Can ESRI servers output GML or GeoPackages?

@achapkowski
Copy link
Author

@jratike80 not directly. Some hosted services can export them to geopackages if registered with ArcGIS Enterprise. GML I do not believe so.

@rouault
Copy link
Member

rouault commented Mar 8, 2024

We're certainly open to contributions from willing contributors to add support for that. Some inspiration could certainly be taken from ogr/ogrpgeogeometry.cpp which deals with geometries from (the old) Personal Geodatabase format that has probably a very similar/identical geometry model and which handles already circular curves and Bezier curves (approximated as linestrings)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants