Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wrong Area for large polygons in vector/Geometry Tools/Export/Add Geometry Columns #15033

Closed
qgib opened this issue Apr 8, 2012 · 9 comments
Closed
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Milestone

Comments

@qgib
Copy link
Contributor

qgib commented Apr 8, 2012

Author Name: alobo - (alobo -)
Original Redmine Issue: 5332
Affected QGIS version: 1.7.4


Results for large polygons are wrong when calculated with vector/Geometry Tools/Export/Add Geometry Columns
Example in
http://dl.dropbox.com/u/3180464/BorneoLCv2google.zip

Check, for example, polygons with ID 25967 and 26570: according to the table,
the areas are
25967: 8550196769
26570: 1736474738

while visual inspection indicates that 26570 is obviously much larger.

Both results are different than those calculated by R:

25967: 9294889613
26570: 205414657947

Discrepancies with R are particularly large for polygons with area > 1E+10

qgis 1.7.4 on ubuntu 10.04 32bits

This might be related to issue #14750

Agus

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2012

Author Name: Giovanni Manghi (@gioman)


I don't think that this is related to #14750 because that issue is different: if the column is not wide enough the value is cut at the end (and there are no differences between the values computed by the field calculator and the "add geometry columns" tool), in this case the values are completely different.

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2012

Author Name: Giovanni Manghi (@gioman)


After all the two issues are not that unrelated.

If you compute areas with the field calculator in a enough wide field, then the values make sense

ID Area_FC
25967 8550196769.93
26570 173647473841.47

Now I can't understand why values computed with R are so different. In QGIS it was used the layer CRS to make such counts, and in R?


  • status_id was changed from Open to Feedback
  • priority_id was changed from 6 to Normal
  • operating_system was changed from ubuntu 10.04 to

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2012

Author Name: Giovanni Manghi (@gioman)


Giovanni Manghi wrote:

After all the two issues are not that unrelated.

If you compute areas with the field calculator in a enough wide field, then the values make sense

ID Area_FC
25967 8550196769.93
26570 173647473841.47

the same values are computed by postgis.

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2012

Author Name: Giovanni Manghi (@gioman)


the same values are computed by postgis.

so I would try to understand why values computed with R are different and eventually close this as duplicate.

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2012

Author Name: alobo - (alobo -)


ok, it seems there are 2 issues here:

  1. The wrong results I get with
    vector/Geometry Tools/Export/Add Geometry Columns
    that are just missing digits to the right for large numbers

Giovanni: which version are you using?

ok to close this part as a duplicate, but the user cannot set the width of the field
in vector/Geometry Tools/Export/Add Geometry Columns, so this specific detail should be
added to #14750

  1. The fact that results provided by R are so different. The most intriguing/worrying is
    that the R results are using package sp and package Rgeos.
    I'm dealing with Edzer Pebesma regarding this issue in R-sig-geo and will keep the list
    informed. Perhaps I will open a new ticket on this specific subject but lets wait
    to see what Edzer says.

Agus

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2012

Author Name: Giovanni Manghi (@gioman)


alobo - wrote:

ok, it seems there are 2 issues here:

  1. The wrong results I get with
    vector/Geometry Tools/Export/Add Geometry Columns
    that are just missing digits to the right for large numbers

Giovanni: which version are you using?

I'm using master, but the issue is definitely #14750

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2012

Author Name: alobo - (alobo -)


Update to issue 2: clarified thanks to Roger Bivand, no need to open another
ticket, QGIS, postgis, and R are coincident (but R is much faster than QGIS, few seconds
against few minutes):

"With rgeos 0.2-5 and GEOS runtime version: 3.3.2-CAPI-1.7.2, I have:

bn <- readOGR(".", "BorneoLCv2google")
b2 <- gArea(bn, byid=TRUE)

print(b2[25967], digits=16)

      25966

8550196769.93012

print(b2[26570], digits=16)

       26569

173647473841.3217

so the hole warnings were the reason for the difference. SVN revision 327 of 16 March enforced the use of createSPComment() in gArea() - the user was expected to denote holes properly themselves before this change. Update your rgeos and try again.

Please update the QGIS #15033 to state that from rgeos 0.2-5, the values are correct. The area slot in the Polygons object is a gross area used to order plotting (because until recently R polygons simply overplotted one another), so it is not guaranteed to be a planar area measure for polygons with holes.

Roger
Roger Bivand
Department of Economics, NHH Norwegian School of Economics,
Helleveien 30, N-5045 Bergen, Norway.
voice: +47 55 95 93 55; fax +47 55 95 95 43
e-mail: Roger.Bivand@nhh.no
"

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2012

Author Name: Giovanni Manghi (@gioman)


alobo - wrote:

(but R is much faster than QGIS, few seconds
against few minutes

counts made with the field calculator take also just a few moments (2/3 seconds in my machine), instead of minutes of the tool in the "vector" menu.

@qgib
Copy link
Contributor Author

qgib commented Apr 9, 2012

Author Name: Giovanni Manghi (@gioman)


As for the original description this is duplicate of #14750


  • resolution was changed from to duplicate
  • status_id was changed from Feedback to Closed

@qgib qgib added the Bug Either a bug report, or a bug fix. Let's hope for the latter! label May 24, 2019
@qgib qgib added this to the Version 1.8.0 milestone May 24, 2019
@qgib qgib closed this as completed May 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Either a bug report, or a bug fix. Let's hope for the latter!
Projects
None yet
Development

No branches or pull requests

1 participant