I have a shapefile of Montreal which includes the geometry of buildings and some attributes like the year of construction. I also have the building's geometrical data from another source. So I know the latitude and longitude (also x y z coordinates) of each vertex of a building.

I want to extract building's features from this shapefile with latitude and longitude of the corresponding vertices. By this way, I can combine the data from both sources by geometrical data.

I imported the shapefile into QGIS and opened the attribute table. The attribute table only shows the building's features, not the coordinates.

I want to know how I can automatically extract features coordinates by QGIS or any other tool from this shapefile?

shapefile imported in QGIS attribute table

I tried the field calculator but the new column does not show any number enter image description here

enter image description here

  • 1
    Welcome to GIS.SE. I think, you got something confused. A feature is usually an object in a (vector) layer. The properties of the feature are called attribute. So if I read it right, you want to extract attributes from your first layer using geometry values/coordinates from the second one? – Erik Apr 30 '19 at 15:15
  • I downloaded all building's geometry from OpenStreetMap website. I want to do some energy analysis and I need the year of construction of each building. Year of construction is not available in OpenStreetMap and I have to use another source. This shapefile includes the year of construction but the arrangment of buildings is not the same in these two files. My idea is to find corresponding buildings by comapring the cooridnate of building points. I have these coordinate for osm file and I am looking for a way to automatically find the cooridnates of building in this shapefile. – ali katal Jun 3 '19 at 22:00

If you want to have a separate column with coordinates you can always use the field calculator.

To use it at first you need to toggle edit mode. Then fill out the form like that: enter image description here

And just click OK. The result will be a geometry as a WKT string. In your case: Polygon((x1,y1,x2,y2,x3,y3...))

| improve this answer | |
  • 1
    Actually, WKT format puts a space between the x and y coordinates. Commas are only used to separate each pair of coordinates, like this: Polygon((x1 y1, x2 y2, x3 y3, ..., x1 y1)). Minor quibble, but important if you're parsing the text. – csk Apr 30 '19 at 18:10

What you are looking for is Extract by location tool:

enter image description here

Or you could also use Join by Location which would "attach" attributes from Montreal shapefile to your buildings shapefile. There are plenty of Q&A on this topic, i.e.: Joining 2 layers by location...,

Difference between the two is that first would extract selected features (buildings) from Montreal shapefile while second takes first layer (your buildings) and only adds attributes from the other layer to it.

Decision what to use depends on what exactly you need..

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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