Difference in area calculation between QGIS and R

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Difference in area calculation between QGIS and R

Suncus Etruscus
Dear List,
I am trying to use R ("sp" and "raster" packages) to calculate the area of
several polygons (CRS of the shapefile EPSG: 4326  - WGS84).

I used this line of code:

shapefile_name$area_km2 <- area(shapefile_name)/1000000

However, when I used QGIS to calculate the area of the same polygons
(through the "$area" function), I found there was a slight difference (in
every polygon).

For example, for a polygon of about 30 000 km2, the area calculated in R
was 50 km2 smaller.

What could be the cause?

Thanks in advance,
N.

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Difference in area calculation between QGIS and R

Michael Sumner-2
Raster uses a (discretized) cosine-of-latitude approximati (popular amongst
longlat map makers).

QGIS uses a project to local equal area projection method or maybe some
other approach.

There's lots and f options, all that matters is what your work needs.

Cheers, Mike

On Wed, 27 Jun 2018, 22:14 Suncus Etruscus, <[hidden email]>
wrote:

> Dear List,
> I am trying to use R ("sp" and "raster" packages) to calculate the area of
> several polygons (CRS of the shapefile EPSG: 4326  - WGS84).
>
> I used this line of code:
>
> shapefile_name$area_km2 <- area(shapefile_name)/1000000
>
> However, when I used QGIS to calculate the area of the same polygons
> (through the "$area" function), I found there was a slight difference (in
> every polygon).
>
> For example, for a polygon of about 30 000 km2, the area calculated in R
> was 50 km2 smaller.
>
> What could be the cause?
>
> Thanks in advance,
> N.
>
>         [[alternative HTML version deleted]]
>
> _______________________________________________
> R-sig-Geo mailing list
> [hidden email]
> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>
--
Dr. Michael Sumner
Software and Database Engineer
Australian Antarctic Division
203 Channel Highway
Kingston Tasmania 7050 Australia

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Difference in area calculation between QGIS and R

edzer

On 06/27/2018 05:29 PM, Michael Sumner wrote:
> Raster uses a (discretized) cosine-of-latitude approximati (popular amongst
> longlat map makers).

As far as I can tell, raster branches into the libgeographic code
(copied into the package sources, although Karney is not mentioned as
one of the package copyright holders), using close to exact geodesic /
ellipsoidal computation.

>
> QGIS uses a project to local equal area projection method or maybe some
> other approach.
>
> There's lots and f options, all that matters is what your work needs.
>
> Cheers, Mike
>
> On Wed, 27 Jun 2018, 22:14 Suncus Etruscus, <[hidden email]>
> wrote:
>
>> Dear List,
>> I am trying to use R ("sp" and "raster" packages) to calculate the area of
>> several polygons (CRS of the shapefile EPSG: 4326  - WGS84).
>>
>> I used this line of code:
>>
>> shapefile_name$area_km2 <- area(shapefile_name)/1000000
>>
>> However, when I used QGIS to calculate the area of the same polygons
>> (through the "$area" function), I found there was a slight difference (in
>> every polygon).
>>
>> For example, for a polygon of about 30 000 km2, the area calculated in R
>> was 50 km2 smaller.
>>
>> What could be the cause?
>>
>> Thanks in advance,
>> N.
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>

--
Edzer Pebesma
Institute for Geoinformatics
Heisenbergstrasse 2, 48151 Muenster, Germany
Phone: +49 251 8333081

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo
Reply | Threaded
Open this post in threaded view
|

Re: Difference in area calculation between QGIS and R

Suncus Etruscus
In reply to this post by Michael Sumner-2
 Thank you for you answer, Michael,
I am new to the use of R for spatial analyses.

I have always used QGIS for this kind of operations, but this time I need
to repeat the area calculation with thousands of polygons several times in
a loop, so I switched to R.

Actually, what my work needs is the most accurate measurement of such
areas. I am wondering if the best thing to do is to accept the results in R
and ignore those in QGIS.

Thanks,
Nick

2018-06-27 17:29 GMT+02:00 Michael Sumner <[hidden email]>:

> Raster uses a (discretized) cosine-of-latitude approximati (popular
> amongst longlat map makers).
>
> QGIS uses a project to local equal area projection method or maybe some
> other approach.
>
> There's lots and f options, all that matters is what your work needs.
>
> Cheers, Mike
>
> On Wed, 27 Jun 2018, 22:14 Suncus Etruscus, <[hidden email]>
> wrote:
>
>> Dear List,
>> I am trying to use R ("sp" and "raster" packages) to calculate the area of
>> several polygons (CRS of the shapefile EPSG: 4326  - WGS84).
>>
>> I used this line of code:
>>
>> shapefile_name$area_km2 <- area(shapefile_name)/1000000
>>
>> However, when I used QGIS to calculate the area of the same polygons
>> (through the "$area" function), I found there was a slight difference (in
>> every polygon).
>>
>> For example, for a polygon of about 30 000 km2, the area calculated in R
>> was 50 km2 smaller.
>>
>> What could be the cause?
>>
>> Thanks in advance,
>> N.
>>
>>         [[alternative HTML version deleted]]
>>
>> _______________________________________________
>> R-sig-Geo mailing list
>> [hidden email]
>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>
> --
> Dr. Michael Sumner
> Software and Database Engineer
> Australian Antarctic Division
> 203 Channel Highway
> <https://maps.google.com/?q=203+Channel+Highway+Kingston+Tasmania+7050+Australia&entry=gmail&source=g>
> Kingston Tasmania 7050 Australia
> <https://maps.google.com/?q=203+Channel+Highway+Kingston+Tasmania+7050+Australia&entry=gmail&source=g>
>
>

        [[alternative HTML version deleted]]

_______________________________________________
R-sig-Geo mailing list
[hidden email]
https://stat.ethz.ch/mailman/listinfo/r-sig-geo