[Qgis-user] writing vector data for QGIS input from a python script using osgeo ogr
Mike Flannigan
mikeflan at att.net
Tue Jan 22 18:15:10 PST 2019
As Etienne said, you can use geojson if you want to.
I recommend it.
Create geojson files that look like this:
{
"type": "FeatureCollection",
"crs": { "type": "name", "properties": { "name":
"urn:ogc:def:crs:OGC:1.3:CRS84" } },
"features": [
{ "type": "Feature", "properties": { "id": 1, "name": "Route 46" },
"geometry": { "type": "LineString", "coordinates": [ [ -90.1322030,
38.9030880 ], [ -90.1321070, 38.9031320 ], [ -90.1321180, 38.9032740
], [ -90.1322400, 38.9033200 ], [ -90.1327310, 38.9033390 ], [
-90.1327700, 38.9033720 ], [ -90.1328080, 38.9034150 ], [ -90.1328500,
38.9034620 ], [ -90.1328940, 38.9035110 ], [ -90.1329390, 38.9035600
], [ -90.1329630, 38.9036120 ], [ -90.1329790, 38.9036700 ], [
-90.1329930, 38.9037210 ], [ -94.8775660, 36.8685670 ] ] } }
You can combine them into one file with a comma between them.
Load that file into QGIS and you have tracks that look like this:
http://www.mflan.com/temp/routes_-_svg.svg
It has the added bonus that if you change the file
while QGIS has it open, the next screen refresh will
usually show the change.
Very cool.
Mike
On 1/22/2019 2:24 AM, qgis-user-request at lists.osgeo.org wrote:
> I’d like to write vector line data in lat/lon coordinates to a file that QGIS can read and display. I have the osgeo ogr module, but can’t see to find the right documentation on how to use it for this simple task.
>
> Thanks,
> Lee
More information about the Qgis-user
mailing list