#6427 closed defect (duplicate)
ogr geoson int attribute converted in string
Reported by: | alaindelplanque | Owned by: | warmerdam |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | default | Version: | unspecified |
Severity: | normal | Keywords: | |
Cc: |
Description
In case we have integer and null values for an attribute in geojson file, OGR make this attribute string instead of int
Look at this exemple:
When ogr read this file:
int_prop2
should have int type, but it has string
It's good for others:
int_prop1
is intdbl_prop1
anddbl_prop2
are double
$ ogrinfo -ro -al points.geojson INFO: Open of `points.geojson' using driver `GeoJSON' successful. Layer name: OGRGeoJSON Geometry: Point Feature Count: 2 Extent: (0.000000, 0.000000) - (1.000000, 0.000000) Layer SRS WKT: GEOGCS["WGS 84", DATUM["WGS_1984", SPHEROID["WGS 84",6378137,298.257223563, AUTHORITY["EPSG","7030"]], AUTHORITY["EPSG","6326"]], PRIMEM["Greenwich",0, AUTHORITY["EPSG","8901"]], UNIT["degree",0.0174532925199433, AUTHORITY["EPSG","9122"]], AUTHORITY["EPSG","4326"]] name: String (0.0) int_prop1: Integer (0.0) int_prop2: String (0.0) <=============== Should be Integer dbl_prop1: Real (0.0) dbl_prop2: Real (0.0) OGRFeature(OGRGeoJSON):0 name (String) = point1 int_prop1 (Integer) = 1 int_prop2 (String) = 1 dbl_prop1 (Real) = 1.1 dbl_prop2 (Real) = 1.1 POINT (0 0) OGRFeature(OGRGeoJSON):1 name (String) = point2 int_prop1 (Integer) = 2 int_prop2 (String) = (null) dbl_prop1 (Real) = 2.1 dbl_prop2 (Real) = (null) POINT (1 0)
System is ubuntu 15.10
$ uname -a Linux 4.2.0-34-generic #39-Ubuntu SMP Thu Mar 10 22:13:01 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux $ ogr2ogr --version GDAL 1.11.2, released 2015/02/10 $ apt-cache showpkg gdal-bin Package: gdal-bin Versions: 1.11.2+dfsg-3ubuntu3 (/var/lib/apt/lists/fr.archive.ubuntu.com_ubuntu_dists_wily_universe_binary-amd64_Packages) (/var/lib/dpkg/status) Description Language: File: /var/lib/apt/lists/fr.archive.ubuntu.com_ubuntu_dists_wily_universe_binary-amd64_Packages MD5: 9b991dff688fb509bc873ba688a660b5 Description Language: en File: /var/lib/apt/lists/fr.archive.ubuntu.com_ubuntu_dists_wily_universe_i18n_Translation-en MD5: 9b991dff688fb509bc873ba688a660b5 Description Language: fr File: /var/lib/apt/lists/fr.archive.ubuntu.com_ubuntu_dists_wily_universe_i18n_Translation-fr MD5: 9b991dff688fb509bc873ba688a660b5 Reverse Depends: python-qgis-common,gdal-bin python-qgis-common,gdal-bin grass-core,gdal-bin gdal-bin:i386,gdal-bin gdal-bin:i386,gdal-bin 1.10.0-0~ doris,gdal-bin thuban,gdal-bin science-geography,gdal-bin qmapshack,gdal-bin qlandkartegt,gdal-bin python3-gdal,gdal-bin python-qgis-common,gdal-bin python-gdal,gdal-bin pktools,gdal-bin openstreetmap-carto,gdal-bin libgeotiff2,gdal-bin libgdal1-1.11.2-grass,gdal-bin grass-core,gdal-bin gis-workstation,gdal-bin gis-remotesensing,gdal-bin geotiff-bin,gdal-bin gdal-bin,gdal-bin 1.10.0-0~ dans-gdal-scripts,gdal-bin Dependencies: 1.11.2+dfsg-3ubuntu3 - libc6 (2 2.15) libgcc1 (2 1:4.1.1) libgdal.so.1-1.11.2 (0 (null)) libgdal1i (2 1.11.0) libstdc++6 (2 5.2) python-gdal (0 (null)) gdal-bin (3 1.10.0-0~) gdal-bin:i386 (3 1.10.0-0~) gdal-bin:i386 (0 (null)) Provides: 1.11.2+dfsg-3ubuntu3 - Reverse Provides:
Change History (5)
comment:1 by , 8 years ago
comment:2 by , 8 years ago
comment:3 by , 8 years ago
It needs a bit of detective work. Starting from the ticket https://trac.osgeo.org/gdal/ticket/6351 you can see that fix affects trunk r33366, branches/2.0 r33367, branches/1.11 r33368
"Milestone set to 1.11.5" reveals that fix will be in 1.11.5
From update timestamps of GDAL news https://trac.osgeo.org/gdal/wiki/Release it is possible to find that 1.11.4 and 2.0.2 were released January 26. 2016
From the timestamp of fixing changeset you can see that it was done Feb 4, 2016 5:57:55 AM
Conclusion 1) Fix is not included in any released 1.11.x or 2.0.x version, but it was deprecation and 1.10 should be OK.
Conclusion 2) It would be an useful improvement to add the release date into NEWS of each version and make a new document with a table showing all release dates on one page.
With GDAL 2.1.0dev, released 2015/99/99 on Windows no problem: