<div dir="ltr"><br clear="all"><div>Safecast is user sourced radiation data, and has a public API serving data in GeoJSON format (<a href="https://api.safecast.org/en-US/home">https://api.safecast.org/en-US/home</a>). However, I'm having difficulty in accessing this data via OGR:</div>
<div><br></div><div>% ogrinfo -so "<a href="https://api.safecast.org/en-US/measurements?distance=10&latitude=37.42&longitude=141.033">https://api.safecast.org/en-US/measurements?distance=10&latitude=37.42&longitude=141.033</a>"</div>
<div>ERROR 4: Failed to read GeoJSON data</div><div>ERROR 4: Failed to read GeoJSON data</div><div>FAILURE:</div><div>Unable to open datasource `<a href="https://api.safecast.org/measurements.json?distance=10&latitude=37.42&longitude=141.033">https://api.safecast.org/measurements.json?distance=10&latitude=37.42&longitude=141.033</a>' with the following drivers.</div>
<div><br></div><div>So OGR sees that the data is formatted as GeoJSON, but is unable to read it for some reason.</div><div><br></div><div>Using curl to manually make the query I get:</div><div><br></div><div>% curl -i -H "Accept: application/json" "<a href="https://api.safecast.org/en-US/measurements?distance=10&latitude=37.42&longitude=141.033">https://api.safecast.org/en-US/measurements?distance=10&latitude=37.42&longitude=141.033</a>"</div>
<div>HTTP/1.1 200 OK</div><div>Server: nginx</div><div>Date: Mon, 05 May 2014 19:43:55 GMT</div><div>Content-Type: application/json; charset=utf-8</div><div>Transfer-Encoding: chunked</div><div>Connection: keep-alive</div>
<div>Status: 200 OK</div><div>Strict-Transport-Security: max-age=31536000</div><div>Access-Control-Allow-Origin: <a href="http://safecast.org">safecast.org</a></div><div>Access-Control-Allow-Methods: POST, GET, OPTIONS</div>
<div>Access-Control-Allow-Headers: *, X-Requested-With</div><div>Access-Control-Max-Age: 100000</div><div>X-UA-Compatible: IE=Edge,chrome=1</div><div>ETag: "e4650539a53d3698d8deb02e912b9ae3"</div><div>Cache-Control: max-age=0, private, must-revalidate</div>
<div>X-Request-Id: a30a38247c16374a39ada0a8d4d2fcde</div><div>X-Runtime: 0.022855</div><div>X-Rack-Cache: miss</div><div>X-Powered-By: cloud66</div><div><br></div><div>[{"captured_at":"2014-01-30T05:03:25Z","device_id":null,"id":30981293,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":4675.0,"latitude":37.41997666666666,"longitude":141.03297166666667},{"captured_at":"2014-01-30T05:25:26Z","device_id":null,"id":30981556,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":2470.0,"latitude":37.42001666666667,"longitude":141.03303666666667},{"captured_at":"2014-01-30T05:00:54Z","device_id":null,"id":30981263,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":5428.0,"latitude":37.41996666666667,"longitude":141.03301666666667},{"captured_at":"2014-01-30T05:21:20Z","device_id":null,"id":30981507,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":12191.0,"latitude":37.420003333333334,"longitude":141.03305333333333},{"captured_at":"2014-01-30T05:00:49Z","device_id":null,"id":30981262,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":5199.0,"latitude":37.41999666666667,"longitude":141.03306166666667},{"captured_at":"2014-01-30T05:25:21Z","device_id":null,"id":30981555,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":2423.0,"latitude":37.42006833333333,"longitude":141.03301333333334},{"captured_at":"2014-01-30T05:03:30Z","device_id":null,"id":30981294,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":4456.0,"latitude":37.41992833333333,"longitude":141.03297333333333},{"captured_at":"2014-01-30T05:00:59Z","device_id":null,"id":30981264,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":5672.0,"latitude":37.419963333333335,"longitude":141.03291666666667},{"captured_at":"2014-01-30T05:00:44Z","device_id":null,"id":30981261,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":5135.0,"latitude":37.420035,"longitude":141.03309},{"captured_at":"2014-01-30T05:21:14Z","device_id":null,"id":30981506,"location_name":null,"original_id":null,"unit":"cpm","user_id":3,"value":12164.0,"latitude":37.42006333333333,"longitude":141.03293666666667}]</div>
<div><br></div><div>Those do look like legitimate observations, but I don't know if they comply to the GeoJSON format since I'm new to JSON.</div><div><br></div><div>I'm using this version of GDAL/OGR, which was part of the pre-packaged binaries for qgis for my Mac:</div>
<div><div>% ogrinfo --version</div><div>GDAL 1.10.1, released 2013/08/26</div></div><div><br></div><div>Eventually I'd like to use GDAL/OGR to conveniently create a local spatial database from such a query. However, I need to get over this hurdle first.</div>
<div><br></div><div>Cheers,</div><div><br></div><div>Mark</div><div>-- <br></div><a href="mailto:mcoletti@gmail.com" target="_blank">mcoletti@gmail.com</a><br><div><br></div>
</div>