1

This question already has an answer here:

I have a polygon shapefile that contains all the neighbourhoods in the Netherlands.

My aim is to export the neighbourhoods and coordinates to CSV file (KWT).

Without success I tried (with QGIS) these 'solutions':

  1. How to export Polygons to CSV with coordinates?
  2. How to get Shapefile point coordinates into .xls?

It got me to the point where I have all the attributes (from my vector layer) in a CSV file. The problem lies in that I can't seem to find any geodata (coordinates) in them.

Where can I find the polygon coordinates to finally export them with the neighbourhoods out my shapefile to CSV?

marked as duplicate by underdark Jan 14 '14 at 19:49

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

Consider what data you need: Polygons can have per definition multiple node coordinates.
Do you want:

  1. The centroid coordinates of the polygons?
  2. The extent (boundary box) of the individual polygon?
  3. The coordinates of the individual nodes?

You can for instance export the latter one (node coordinates) as WKT text in your csv file if you create this column in the attribute table first. This can be done in QGIS with the fieldcalculator and the following command:

 geomToWKT(  $geometry )
  • Thanks for you reply. The coordinates will be used for a locatonbased webapplication to specify if objects are in a certain neighbourhood. I would say that the data you mention under 2 would be the one i need then? – user25765 Jan 14 '14 at 14:00
  • I am folling the instructions with the geomToWKT command. However after saving my changes QGiS seem to reset all my polygons and set them to 0. Bug? – user25765 Jan 14 '14 at 16:03
  • @user25765 Did you create a numerical field? The WKT will need to be stored in a text field. – underdark Jan 14 '14 at 19:53
  • Tried it with a text field. So simple. Many many thanks!! – user25765 Jan 14 '14 at 20:39
  • The polygon coordinates i generated from my file give an error on import: specified location data = invalid. According to my geolibrary actually it looks for: code $polygon = geoPHP:load('POLYGON((1 1,5 1,5 5,1 5,1 1),(2 2,2 3,3 3,3 2,2 2))','wkt'); $area = $polygon->getArea(); $centroid = $polygon->getCentroid(); $centX = $centroid->getX(); $centY = $centroid->getY(); What kind of formula would i need to apply in my field calculator to stay within the format of geophp? (Sorry, but adding spaces didn't give me linebrakes) – user25765 Jan 16 '14 at 12:01

Not the answer you're looking for? Browse other questions tagged or ask your own question.