[gdal-dev] Overflow in geojson values

Smith, Michael ERDC-RDE-CRREL-NH Michael.Smith at erdc.dren.mil
Thu Aug 1 11:31:12 PDT 2013


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



More information about the gdal-dev mailing list