I have a raster that is projected to a state plane CRS and I am adding polygon/polyline shapefiles that are projected to WGS84. On the fly transformation is set to reproject to my raster CRS. When I use the identify features tool to select a feature, under derived I can see the correct area/length measurements. Is there a way to transfer that exact information into a new column(s) in the attributes by using the field calculator?
-
Do you have a specific use case for needing a duplicate field?– Brad NesomCommented Aug 21, 2013 at 4:15
-
The data under derived is not viewable in the attributes and would like to be able to view that data on other platforms– wonderstruck80Commented Aug 21, 2013 at 4:49
-
Ok my bad. I don't use qgis everyday, see comment on answer. I am pretty sure qgis works like this too.– Brad NesomCommented Aug 21, 2013 at 5:03
2 Answers
If you are not sure about the right units of measurements, save a copy of the shapefile into the CRS of the raster.
That way you will get the correct values using the $area function in field calculator.
Note that identify tool and field calculators use different methods to calculate areas: https://hub.qgis.org/issues/4252
Vector -> Geometry Tools -> Export/Add geometry columns
lets you choose if measurement of the new columns shall be in layer CRS, project CRS or ellipsodial (which the identify tool uses).
Add a column of the type you desire to use.
Use field calculator,
My field = [area]
Not exact syntax.
-
So by using $area expression in the field calculator, the area is calculated based off of the layer's CRS (WGS84) which will yield either an unusable answer or 0. I am wondering if there is a specific expression that will read the info that is under derived. Commented Aug 21, 2013 at 4:46
-
$area would work if you have a spatial database. [area] is the existing area field. Commented Aug 21, 2013 at 4:55
-
You are saying that your layer is in WGS but the area field is in your desired units? I don't have qgis in front of me. But if I were in arcmap I would set the document projection to the units I want, and calculate the length or area using the document units. Possibly a check box Commented Aug 21, 2013 at 5:01
-
1$area will return the area of the polygon in the layers units.– Nathan WCommented Aug 21, 2013 at 5:17