The following Points layer is the basis of a rendering in a Android application.
Android allows to draw a shape from the provided points. I cannot use LineStrings.
However, the order of points exported from QGIS seems to be odd.
Is there any way to visually sort the order of points in QGIS or using the GDAL tools? The order of feature ids in the final export format (such as CSV) needs to be kind of a roundtrip as visualized in the following picture. If there are multiple paths or a "hole" it is perfectly okay to have multiple point layers.
Export experiments
I tried different steps to get hold of the latitude/longitude coordinates:
- QGIS: Export points layer as CSV, add layer create options:
GEOMETRY=AS_YX
- Convert into Android specific format JSON format using regular expressions.
This has the disadvantage that the feature id is still included. The order of points however is not as desired.
ogr2ogr -f CSV output.csv input.shp -lco GEOMETRY=AS_YX
- Convert into Android specific format JSON format using regular expressions.
Here the feature id is already omitted. The order of points however is not as desired.
- QGIS: Export points layer as GML
ogr2ogr -f "CSV" -select "" output.csv input.gml -lco "GEOMETRY=AS_YX"
- Convert into Android specific format JSON format using regular expressions.
The order of points however is not as desired. The order of points is different to what the former exports/conversions output.
The original layer is also available as a LineString layer.
Answer
I tried this in QGIS:
- Load the polyline data from OSM
- Reproject it to UTM 32N
Vector -> Geoprocessing -> Buffer
with a value of 10 (metres) forBuffer distance
.Vector -> Geoprocessing -> Dissolve
usingdissolve all
will lead to one polygonVector -> Geometry Tools -> Multipart to single part
creates one polygon for every LEZ with a hole in the middleVector -> Geometry Tools -> Polygons to Lines
Vector -> Geometry Tools -> Lines to Polygons
Vector -> Geoprocessing -> Dissolve
usingdissolve all
will remove the inner ringVector -> Geometry Tools -> Multipart to single part
creates one polygon for every LEZ without hole- Using Field Calculator, create unique ids with a new field filled with $id
- Install the MMQGIS plugin
MMQGIS -> Import/Export -> Geometry Export
to CSV
For checking:
- Import as Delimited text layer
- Install Points2One plugin
- Join the points to a line with Points2One
This works for Münster, but may fail on other cities (like Frankfurt, where a segment of the border is missing).
No comments:
Post a Comment