1

I'm getting strange results with area calculations via the field calculator, when I'm working with a geopackage file. The field calculator is returning a negative values for some of the polygons. I can get it to return the (apparently) correct values by saving the layer as a shapefile, and using the same calculation.

Is there a way to correct this behavior without exporting the layer to a different format, or do I need to avoid geopackages when manipulating data?

This is similar to the problem in some other posts: Why do area calculations return negative values? Area is calculating wrong using $area in field calculator (QGIS 2.8.1-Wien) Wrong $area from field calculator (QGIS)

The file I'm having trouble with is a selection of parcels from a larger parcel data set with parcels within a limited extent merged by owner: https://www.dropbox.com/s/nwgg8stxrglcdn8/MergedParcels.gpkg?dl=0

There are multi-part features in the file, but I still get the negative values after using multi-part to single part vector geometry tool.

I'm using QGIS 2.18.2 on a Windows computer. My project is in EPSG: 102748 (Washington State Plane North- US Feet), as is the geopackage.

I'm getting the same results with On-the-fly projection both on and off. The formula I'm using in the field calculator is:

round($area/43560,2)

My project properties are set to calculate areas and distances in map units (feet/square feet).

1

You have invalid geometries in your GeoPackage. The first one has fid=1 and the geometry as WKT is

POLYGON (( 1813238.237615 502083.028161, 1813137.278915 502083.299924, 1813140.009136 501956.761122, 1813098.663328 502003.958433, 1813058.121219 502038.060553, 1813015.445999 502084.951444, 1812959.966243 502138.236482, 1812917.291135 502197.915473, 1812893.817919 502249.068373, 1812870.347421 502310.87813, 1812859.678946 502379.08184, 1812859.67945 502436.628611, 1812866.082231 502492.045076, 1812878.885104 502558.118022, 1812900.223367 502609.270579, 1812917.292698 502639.108797, 1813030.38711 502724.363774, 1813090.134629 502784.040667, 1813121.677467 502806.400731, 1813156.282034 502830.930396, 1813235.549099 502889.659955, 1813231.228382 502874.17536, 1813200.15065 502762.795332, 1813165.242618 502665.117802, 1813168.483871 502636.568804, 1813194.978411 502544.104401, 1813203.572806 502523.546857, 1813229.599756 502498.661081, 1813251.315721 502483.340002, 1813280.696307 502450.145448, 1813315.446095 502423.13985, 1813329.238415 502406.736478, 1813342.012138 502365.881923, 1813360.406458 502340.354145, 1813374.238686 502310.364446, 1813379.671248 502283.352182, 1813360.624101 502241.49557, 1813330.147409 502203.445487, 1813326.336995 502127.343246, 1813345.474595 502082.739289, 1813238.237615 502083.028161 ), ( 1813141.644317 501880.962644, 1813146.66202 501648.403479, 1813126.00078 501655.23174, 1813040.727692 501665.4332, 1812968.455375 501673.674255, 1812829.791312 501644.980653, 1812783.492281 501644.599438, 1812700.716262 501654.336968, 1812642.033665 501776.559586, 1812878.683053 501776.557803, 1812877.69108 501832.754183, 1812872.786965 502110.530692, 1812462.701763 502110.533805, 1812389.616483 502235.066917, 1812348.005918 502320.641003, 1812210.708642 502588.034331, 1812594.629654 502602.159384, 1812856.13075 502611.780768, 1812836.209362 502545.329923, 1812821.27079 502496.3079, 1812817.760154 502447.206721, 1812817.003223 502368.425308, 1812819.136018 502319.404467, 1812842.606787 502251.199347, 1812870.346339 502187.257988, 1812902.352431 502133.974439, 1812930.092188 502093.478037, 1812968.500979 502048.71809, 1813015.445309 502006.09096, 1813051.718308 501967.725407, 1813083.727194 501933.623352, 1813141.644317 501880.962644 ))

It is a polygon with a hole, and the hole lies outside the cell

enter image description here

There are more similar cases in the data. So GeoPackage is not the problem but bad data.

  • Thank you, I guess perhaps I'm asking the wrong question, and it would be better to try and figure out what in my work flow is causing the bad geometery. – Brian Fisher Jun 13 '17 at 22:14

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.