[gdal-dev] Overflow in geojson values

Frank Warmerdam warmerdam at pobox.com
Thu Aug 1 13:36:11 PDT 2013


On Thu, Aug 1, 2013 at 1:32 PM, Even Rouault
<even.rouault at mines-paris.org>wrote:

> Selon Dmitriy Baryshnikov <bishop.dev at gmail.com>:
>
> > Hi,
> >
> > GDAL GeoJSON driver use modified and outdated json-c. It seem to me that
> > this is the bug and ticket in track needed.
>
> It would be a 2 step work. I indeed see that newer json-c supports int64,
> so a
> first step would be to make the GeoJSON driver uses the new json-c 64 bit
> API.
> But OGR does not support int64 yet, so the overflow would occur just
> afterwards.
> There's an RFC ( http://trac.osgeo.org/gdal/wiki/rfc31_ogr_64 ) about that
> waiting for implementation.
>

Folks,

Also waiting for final refinement and adoption...

I think I'd like to revisit this issue before the next major release since
it is negatively impacting a number of drivers - not just geojson.

Best regards,
Frank


>
> Best regards,
>
> Even
>
> >
> > Best regards,
> >      Dmitriy
> >
> > 01.08.2013 22:31, Smith, Michael ERDC-RDE-CRREL-NH Ð¿ÐžÑ ÐµÑ :
> > > Unfortunately, that¹s after the data has been read and overflowed.
> > >
> > > The time should be 1375291903959.
> > > Updated should be 1375295733317.
> > >
> > > Mike
> > >
> > > On 8/1/13 2:21 PM, "Kyle Shannon" <kyle at pobox.com> wrote:
> > >
> > >> On Thu, Aug 1, 2013 at 11:36 AM, Smith, Michael ERDC-RDE-CRREL-NH
> > >> <Michael.Smith at erdc.dren.mil> wrote:
> > >>> I'm reading a geojson feed put out by the USGS
> > >>>
> > >>> (
> http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.geojson
> > >>> )
> > >>> but the time/updated values are overflowing. Are there any settings
> to
> > >>> allow
> > >>> the data to come across as bigint or strings?
> > >>>
> > >>> For example:
> > >>> {"type":"Feature","properties":{"mag":0.46,"place":"2km W of Lemmon
> > >>> Valley,
> > >>>
> > >>>
> Nevada","time":1375291903959,"updated":1375295733317,"tz":-420,"url":"htt
> > >>> p://earthquake.usgs.gov/earthquakes/eventpage/nn00419191
> ","detail":"http:
> > >>> //
> earthquake.usgs.gov/earthquakes/feed/v1.0/detail/nn00419191.geojson","f
> > >>>
> elt":null,"cdi":null,"mmi":null,"alert":null,"status":"REVIEWED","tsunami
> > >>>
> ":null,"sig":3,"net":"nn","code":"00419191","ids":",nn00419191,","sources
> > >>>
> ":",nn,","types":",cap,general-link,geoserve,nearby-cities,origin,","nst"
> > >>>
> :12,"dmin":0.069,"rms":0.1034,"gap":74,"magType":"ml","type":"earthquake"
> > >>>
> },"geometry":{"type":"Point","coordinates":[-119.8773,39.632,5.0829]},"id
> > >>> ":"nn00419191"}
> > >>>
> > >>> Gets returned as
> > >>>
> > >>> OGRFeature(OGRGeoJSON):176
> > >>>    mag (Real) = 1.7
> > >>>    place (String) = 21km S of Lowell, Oregon
> > >>>    time (Integer) = 902732480
> > >>>    updated (Integer) = 903846662
> > >>>    tz (Integer) = -420
> > >>>    url (String) =
> > >>> http://earthquake.usgs.gov/earthquakes/eventpage/uw60561592
> > >>>    detail (String) =
> > >>>
> > >>>
> http://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/uw60561592.geojso
> > >>> n
> > >>>    felt (String) = (null)
> > >>>    cdi (String) = (null)
> > >>>    mmi (String) = (null)
> > >>>    alert (String) = (null)
> > >>>    status (String) = REVIEWED
> > >>>    tsunami (String) = (null)
> > >>>    sig (Integer) = 44
> > >>>    net (String) = uw
> > >>>    code (String) = 60561592
> > >>>    ids (String) = ,uw60561592,
> > >>>    sources (String) = ,uw,
> > >>>    types (String) = ,cap,general-link,geoserve,nearby-cities,origin,
> > >>>    nst (Integer) = (null)
> > >>>    dmin (Real) = 0.24254513
> > >>>    rms (Real) = 0.24
> > >>>    gap (Real) = 118.8
> > >>>    magType (String) = Md
> > >>>    type (String) = quarry
> > >>>    POINT (-122.7927 43.7262 0)
> > >>>
> > >>> _______________________________________________
> > >>> gdal-dev mailing list
> > >>> gdal-dev at lists.osgeo.org
> > >>> http://lists.osgeo.org/mailman/listinfo/gdal-dev
> > >> Try the cast operator in ogr sql:
> > >>
> > >> kyle at kyle-workstation:~$ ogrinfo -sql 'select *, cast(time as
> > >> character(0)),cast(updated as character(0)) from OGRGeoJSON'
> > >> /vsicurl/
> http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.
> > >> geojson
> > >>
> > >> ...
> > >>
> > >>
> > >> OGRFeature(OGRGeoJSON):185
> > >>   mag (Real) = 2.4
> > >>   place (String) = 29km N of Brenas, Puerto Rico
> > >>   time (Integer) = 905049680
> > >>   updated (Integer) = 908474945
> > >>   tz (Integer) = -240
> > >>   url (String) =
> > >> http://earthquake.usgs.gov/earthquakes/eventpage/pr13212004
> > >>   detail (String) =
> > >>
> http://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/pr13212004.geojson
> > >>   felt (String) = (null)
> > >>   cdi (String) = (null)
> > >>   mmi (String) = (null)
> > >>   alert (String) = (null)
> > >>   status (String) = REVIEWED
> > >>   tsunami (String) = (null)
> > >>   sig (Integer) = 89
> > >>   net (String) = pr
> > >>   code (String) = 13212004
> > >>   ids (String) = ,pr13212004,
> > >>   sources (String) = ,pr,
> > >>   types (String) =
> ,cap,geoserve,nearby-cities,origin,tectonic-summary,
> > >>   nst (String) = 13
> > >>   dmin (Real) = 0.30722383
> > >>   rms (Real) = 0.27
> > >>   gap (Real) = 219.6
> > >>   magType (String) = Md
> > >>   type (String) = earthquake
> > >>   time (String) = 905049680
> > >>   updated (String) = 908474945
> > >>   POINT (-66.3495 18.7346 29)
> > >>
> > >> note the values at the bottom, time and update as (String).  You could
> > >> write the entire field list in  the sql and substitue time and updated
> > >> for the casted values.
> > >>
> > >> kss
> > > _______________________________________________
> > > gdal-dev mailing list
> > > gdal-dev at lists.osgeo.org
> > > http://lists.osgeo.org/mailman/listinfo/gdal-dev
> > >
> > >
> >
> > _______________________________________________
> > gdal-dev mailing list
> > gdal-dev at lists.osgeo.org
> > http://lists.osgeo.org/mailman/listinfo/gdal-dev
>
>
> _______________________________________________
> gdal-dev mailing list
> gdal-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/gdal-dev
>



-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam,
warmerdam at pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Software Developer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20130801/cf3354e5/attachment-0001.html>


More information about the gdal-dev mailing list