[R-sig-Geo] Calculating area of polygons

Wincent ronggui.huang at gmail.com
Tue Feb 15 15:09:34 CET 2011


Thans Ashton. My object is SpatialPolygonsDataFrame, which is imported
from arc GIS shapefile. It has such slots,

> slotNames(obj)
[1] "data"        "polygons"    "plotOrder"   "bbox"        "proj4string"

How can I figure out if this object has info about SRID?

Yeah, I may follow your suggestion by comparing the area attributes
and actual size of the area.

Best
Ronggui

On 15 February 2011 21:50, Ashton Shortridge <ashton at msu.edu> wrote:
> Hi Ronggui,
>
> the spatial units are distinct from the projection and datum component of the
> coordinate reference system.  For example, I could use data projected to
> Lambert Equal Area with particular parameters that were in meters, feet,
> miles, rods, etc.
>
> "Hong Kong 1980 Grid System" tells me it's projected, but doesn't tell me the
> units. Your object may have a particular spatial reference ID code (SRID)
> associated with it - if you look this up on the internet, you can find out the
> units. Alternatively there may be a parameter string that includes the units.
> Finally, if you can display your data in a GIS, and you know the region fairly
> well, you can probably figure out the units (e.g. if you know your area is
> about 10 km across, and a distance check indicates the distance is 11500, then
> you have meters. If it's more like 35000, it's feet.
>
> Hope this helps,
>
> Ashton
>
> On 2011-02-15, Wincent, wrote:
>> Thanks Alex.
>>
>> Also, my object is projected to "Hong Kong 1980 Grid System", so the
>> unit of area is square meters. Is it a confirmative answer? Thanks
>> again.
>>
>> Best
>> Ronggui
>>
>> On 15 February 2011 19:57, Alexandre Villers
>>
>> <villers.alexandre at gmail.com> wrote:
>> > Good afternoon,
>> >
>> > I guess it will be the unit of your original SpatialPolygons object. If
>> > you use a projected coordinate system, the unit should be in meters,
>> > otherwise, I'm not sure of this, but it should be in squared degrees.
>> >
>> > HTH
>> >
>> > Alex
>> >
>> > Le 15/02/2011 10:31, Wincent a écrit :
>> >> The previous email was rejected, so I re-send it. Sorry for disturbing.
>> >>
>> >> Regards
>> >>
>> >> On 15 February 2011 16:23, Wincent<ronggui.huang at gmail.com>  wrote:
>> >>> Dear all,
>> >>>
>> >>> According to
>> >>> https://stat.ethz.ch/pipermail/r-sig-geo/2009-May/005741.html,
>> >>> the area of polygon can be accessed by
>> >>>
>> >>>> areas<- sapply(slot(scot_BNG, "polygons"), function(x) sapply(slot(x,
>> >>>> "Polygons"), slot, "area"))
>> >>>
>> >>> My question is what is the unit of the area? Is it sq km?
>> >>> Thank you very much in advance.
>> >>>
>> >>> Regards
>
>
> -----
> Ashton Shortridge
> Associate Professor                     ashton at msu.edu
> Dept of Geography                       http://www.msu.edu/~ashton
> 235 Geography Building          ph (517) 432-3561
> Michigan State University               fx (517) 432-1671
>



-- 
Wincent Ronggui HUANG (PhD)
http://asrr.r-forge.r-project.org/rghuang.html



More information about the R-sig-Geo mailing list