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.