I want to use QGIS to write polyline coordinates in a file. I did already successfully created .shp file. But It is hard to code(in C#) to fetch the coordinates. I need to fetch the coordinates in my tool to perform different calculations. QGIS is a very easy and free way to avoid creating a gui just of creating polyline files.
Asked
Active
Viewed 210 times
0
-
Please edit your question to contain an explicit question. Questions about coding are expected to have code in them, with as far as you have gotten, and details about where you need to go. – Vince Jan 07 '16 at 02:02
1 Answers
0
I think GeoJSON would be your best format.
If you want to host it online and use a web gui to make your edits, there is GeoJSON.io
https://github.com/mapbox/geojson.io
But if you want to stick to QGIS desktop, I think you're going to have to use a .SHP to create and edit your lines (or PostGIS if you've got the banwidth), then convert the .SHP to GeoJSON (right-click layer, save as, choose GeoJSON format, coordinate system - which will work with a PostGIS layer in QGIS as well...). That's a manual way to do it, but you might script it somehow as well...
DPSSpatial_BoycottingGISSE
- 18,790
- 4
- 66
- 110
-
Why couldn't a csv output with the polyline coordinates as WKT be an option? I've put this as a comment as I've no knowledge of C#! – Andrew Tice Jan 07 '16 at 10:49
-
@AndrewTice I tried this last night but couldn't get it to work ... let me try again... – DPSSpatial_BoycottingGISSE Jan 07 '16 at 14:01
-
@AndrewTice trying this again, I can create a CSV with WKT geometry type, and although I can start an edit session and create a new line, QGIS doesn't give the option to save, and when you try and stop editing and save, the new feature doesn't get committed to the CSV... are you getting it to work? – DPSSpatial_BoycottingGISSE Jan 07 '16 at 14:05
-
Australian time, sorry! Wouldn't the same thing happen with GeoJSON? You'd have to commit the changes to the file and do a "save as" in both instances. My initial comment was more about the OPs ability to generate a file format that could be easily read in C#. A flat file seemed more useful. – Andrew Tice Jan 07 '16 at 20:53
-
That's true, that's why I said in QGIS you'd have to create / edit geometry using SHP and export to GeoJSON - but i think what you're saying is you could also export to CSV too, right? – DPSSpatial_BoycottingGISSE Jan 07 '16 at 20:54
-
Yup...I think we might be talking at crossed purposes here! Sorry for the confusion. Jonab sounds like he wanted something relatively straight forward (draw a line, import to C#), a form of CSV file seemed easier to me. – Andrew Tice Jan 07 '16 at 20:58
-
Well... how to draw that line and get it into the CSV is what is complicating this I think... using QGIS to draw SHP's and export to CSV is the same as exporting to GeoJSON - but maybe I'm missing something...? – DPSSpatial_BoycottingGISSE Jan 07 '16 at 21:14
-
...anything to generate the lines and export them is going to be a bit of a fiddle! I was focusing on this part of the question
But It is hard to code(in C#) to fetch the coordinates.
...which is why I was thinking about a file format that could be nearly universally read without too much effort.
– Andrew Tice Jan 07 '16 at 21:48 -
Well with that said I don't know what the difference in using CSV vs. GeoJSON with C# is!!! – DPSSpatial_BoycottingGISSE Jan 07 '16 at 22:11
-
1...and neither do I! I think we should stop this now...before we get moderated! – Andrew Tice Jan 07 '16 at 22:34