Uploaded image for project: 'GeoTools'
  1. GEOT-5780

OGR GeoJSON layer name changes with GDAL 2.2 or later, breaking BridjOGRDataStoreTest

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Medium
    • Resolution: Fixed
    • Affects Version/s: 18-beta
    • Fix Version/s: 17.2, 16.5, 18-beta
    • Component/s: ogr
    • Labels:
      None

      Description

      With GDAL 2.2 or later, the layer name of a GeoJSON datasource is set to the name member of the FeatureCollection, if it exists:
      http://www.gdal.org/drv_geojson.html

      Previous versions of GDAL set the layer name to OGRGeoJSON.

      This change breaks (for example) BridjOGRDataStoreTest.testAttributesWritingGeoJSON, which expects the old name OGRGeoJSON, not the new name junk set under GDAL 2.2:

      Tests run: 28, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.251 sec <<< FAILURE! - in org.geotools.data.ogr.bridj.BridjOGRDataStoreTest
      testAttributesWritingGeoJSON(org.geotools.data.ogr.bridj.BridjOGRDataStoreTest)  Time elapsed: 0.01 sec  <<< ERROR!
      java.io.IOException: Schema 'OGRGeoJSON' does not exist.
      	at org.geotools.data.store.ContentDataStore.ensureEntry(ContentDataStore.java:620)
      	at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:393)
      	at org.geotools.data.store.ContentDataStore.getFeatureSource(ContentDataStore.java:360)
      	at org.geotools.data.ogr.OGRDataStoreTest.testAttributesWritingGeoJSON(OGRDataStoreTest.java:407)
      

      Solution is for the test to use the layer name that is found, not hard-code the old one.

      Users should take note that OGR GeoJSON layer names may depend on the version of GDAL installed on their platforms.

        Attachments

          Issue links

            Activity

              People

              • Assignee:
                bencaradocdavies Ben Caradoc-Davies
                Reporter:
                bencaradocdavies Ben Caradoc-Davies
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: