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

OpenFileGDB: set xml shape type to "esriGeometryPolyline" when using arc pro layer creation options #9033

Merged
merged 4 commits into from
Jan 5, 2024

Conversation

adamgutons
Copy link
Contributor

@adamgutons adamgutons commented Jan 4, 2024

What does this PR do?

Since ArcGIS Pro only handles "polyline", and there is no distinction between "esriGeometyLine" and "esriGeometryPolyline", this pull request sets the feature class XML metadata to "esriGeometryPolyline" any time TARGET_ARCGIS_VERSION=ARCGIS_PRO_3_2_OR_LATER is used as a layer creation option.
https://pro.arcgis.com/en/pro-app/latest/arcpy/classes/geometry.htm

What are related issues/pull requests?

Tasklist

  • ADD YOUR TASKS HERE
  • Make sure code is correctly formatted (cf pre-commit configuration)
  • Add test case(s)
  • Add documentation
  • Updated Python API documentation (swig/include/python/docs/)
  • Review
  • Adjust for comments
  • All CI builds and checks have passed

Environment

Provide environment details, if relevant:

  • OS:
  • Compiler:

@adamgutons adamgutons changed the title OpenFileGDB: xml shape type esriGeometryPolyline when arc pro layer creation OpenFileGDB: set xml shape type to "esriGeometryPolyline" when using arc pro layer creation options Jan 4, 2024
@rouault
Copy link
Member

rouault commented Jan 4, 2024

@adamgutons I assume you've tested to open with ArcGIS Pro 3.2 datasets generated with this change ? For my information, how did ArcGIS Pro react on datasets with esriGeometyLine, before this change? And when creating a line layer with ArcGIS Pro 3.2, does it use esriGeometryPolyline?

@rouault
Copy link
Member

rouault commented Jan 4, 2024

It would be appropriate to add a new test case for that in autotest/ogr/ogr_openfilegdb_write.py : creating a layer with geom_type = ogr.wkbLineString and TARGET_ARCGIS_VERSION=ARCGIS_PRO_3_2_OR_LATER, and testing its geometry type on re-opening

Something like (untested):

def test_ogr_openfilegdb_write_line_layer_arcgis_pro_3_2():

    dirname = "/vsimem/test_ogr_openfilegdb_write_line_layer_arcgis_pro_3_2.gdb"
    try:
        ds = ogr.GetDriverByName("OpenFileGDB").CreateDataSource(dirname)
        ds.CreateLayer("test", geom_type=ogr.wkbLineString, options=["TARGET_ARCGIS_VERSION=ARCGIS_PRO_3_2_OR_LATER"])
        ds = None

        ds = ogr.Open(dirname)
        lyr = ds.GetLayer(0)
        assert lyr.GetGeomType() == ogr.wkbMultiLineString

    finally:
        gdal.RmdirRecursive(dirname)

@adamgutons
Copy link
Contributor Author

adamgutons commented Jan 4, 2024

@adamgutons I assume you've tested to open with ArcGIS Pro 3.2 datasets generated with this change ? For my information, how did ArcGIS Pro react on datasets with esriGeometyLine, before this change? And when creating a line layer with ArcGIS Pro 3.2, does it use esriGeometryPolyline?

@rouault I did test in 3.2, and the datasets will open fine and can be edited/geometries added. I tested prior to the change (with esriGeometyLine) in Pro 2.9 and 3.2, the datasets again open just fine and can be edited/geometries added. Anytime a line feature class is created in 3.2, it is alway "esriGeometryPolyline". I also added the suggested unit test.

In the gdb_samples.zip file you will find

testArcPro.gdb -> generated this file using this fix branch and lco TARGET_ARCGIS_VERSION=ARCGIS_PRO_3_2_OR_LATER

testStandard.gdb -> generated this file without lco TARGET_ARCGIS_VERSION=ARCGIS_PRO_3_2_OR_LATER

testLineArcProUI.gdb -> generated this file via ArcPro 3.2 application user interface. I used dump_gdbtable.py to confirm shapetype in the xml is always "esriGeometryPolyline"

gdb_samples.zip

@rouault
Copy link
Member

rouault commented Jan 4, 2024

some code formatting issues. Please see https://gdal.org/development/dev_practices.html#commit-hooks to setup pre-commit and do a manual run of it to fix the issues

@coveralls
Copy link
Collaborator

coveralls commented Jan 5, 2024

Coverage Status

coverage: 68.736% (-0.004%) from 68.74%
when pulling c56af0d on adamgutons:arcpro_multiline_xml
into bf5289c on OSGeo:master.

@rouault rouault merged commit c4afe36 into OSGeo:master Jan 5, 2024
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants