<div dir="ltr"><div><div><div>Hi all<br><br></div>I have just tested QGIS master build againt GDAL "trunk" (build via a git clone from GDAL github repository & following the doc instructions [1] ).<br></div>It works like a charm with a small roads dataset.<br><br></div>Thanks Even (and other involved devs and funders ) for making this happen !<br><div><div><br></div><div>I have seen one first caveat :<br><br></div><div>* Export a Shapefile to GeoJSON in QGIS via the "Save as" and choose to keep only 1 number for decimal precision<br></div><div>* Open this GeoJSON file, toggle edition, and add a new feature<br></div><div>* The new feature geometries are written with default decimal precision (for example : 6790978.453365888446569 ) and not like the other original features ( for example : 6790978.4 )<br></div><div><br></div><div>We should have a way in QGIS to keep the original decimal precision. Any clue on this ? Should I open a ticket ?<br><br></div><div>Regards<br></div><div>Michaël<br></div><div><br>[1] <a href="https://trac.osgeo.org/gdal/wiki/BuildingOnUnix">https://trac.osgeo.org/gdal/wiki/BuildingOnUnix</a><br><br></div></div></div><div class="gmail_extra"><br><div class="gmail_quote">2016-01-14 20:57 GMT+01:00 Even Rouault <span dir="ltr"><<a href="mailto:even.rouault@spatialys.com" target="_blank">even.rouault@spatialys.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">Le jeudi 14 janvier 2016 20:38:04, Nyall Dawson a écrit :<br>
> On 15 Jan 2016 2:39 AM, "Even Rouault" <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br>
> > A more "streaming-like" approach for the driver not proceeding to full<br>
> > ingestion of features could be desirable to remove that limitation, but<br>
><br>
> that's<br>
><br>
> > more involved. A possibility could be to have a "at-hand" parser to<br>
><br>
> delimitate<br>
><br>
> > JSon "Feature" objects and use only json-c to parse each feature. But<br>
><br>
> GeoJSON<br>
><br>
> > is certainly not the more appropriate file format to deal with huge<br>
><br>
> datasets...<br>
><br>
><br>
> Even,<br>
><br>
> Editable GeoJSON in OGR is great news!<br>
><br>
> I've got a question regarding the geojson driver you may be able to assist<br>
> with. Is there any method in the OGR libraries which allow direct parsing<br>
> of a string to a  layer? (Ie, without first writing it out to a file).<br>
><br>
> I'd like to add the ability to directly paste geojson text into QGIS and<br>
> have it inserted as a feature in the current layer (like how you can<br>
> currently paste WKT text as a feature). I don't want to have to manually<br>
> parse the json (that would be a nightmare).<br>
<br>
</span>Well, the GeoJSON driver support "filenames" which are in fact GeoJSON content:<br>
<br>
$ ogrinfo '{"type":"Feature","properties":{"foo":"bar"},"geometry":{"type":"Point","coordinates":[2,49]}}' -ro -al<br>
<br>
Layer name: OGRGeoJSON<br>
Geometry: Point<br>
Feature Count: 1<br>
Extent: (2.000000, 49.000000) - (2.000000, 49.000000)<br>
Layer SRS WKT:<br>
GEOGCS["WGS 84",<br>
    DATUM["WGS_1984",<br>
        SPHEROID["WGS 84",6378137,298.257223563,<br>
            AUTHORITY["EPSG","7030"]],<br>
        AUTHORITY["EPSG","6326"]],<br>
    PRIMEM["Greenwich",0,<br>
        AUTHORITY["EPSG","8901"]],<br>
    UNIT["degree",0.0174532925199433,<br>
        AUTHORITY["EPSG","9122"]],<br>
    AUTHORITY["EPSG","4326"]]<br>
foo: String (0.0)<br>
OGRFeature(OGRGeoJSON):0<br>
  foo (String) = bar<br>
  POINT (2 49)<br>
<br>
Works also with FeatureCollections.<br>
Alternatively, you could also put the content in a in-memory GDAL file (/vsimem/ virtual file system) and open it.<br>
<br>
So you could likely instanciate a temporary layer and get a QGIS feature from that.<br>
<br>
<br>
If you are just interested in geometries and not attributes, there's also the C function :<br>
<br>
OGRGeometryH    OGR_G_CreateGeometryFromJson (const char *);<br>
<span class="im HOEnZb"><br>
<br>
><br>
> If I could somehow take advantage of OGR's geojson driver to do the heavy<br>
> lifting then this work would be trivial.<br>
><br>
> Any ideas?<br>
><br>
> Nyall<br>
<br>
</span><span class="im HOEnZb">--<br>
Spatialys - Geospatial professional services<br>
<a href="http://www.spatialys.com" rel="noreferrer" target="_blank">http://www.spatialys.com</a><br>
</span><div class="HOEnZb"><div class="h5">_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
List info: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
Unsubscribe: <a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" rel="noreferrer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></div></div></blockquote></div><br></div>