[R-sig-Geo] Center of mass of a SpatialPointsDataFrame object - Which projection?

Barry Rowlingson b.rowlingson at lancaster.ac.uk
Fri Jun 8 11:52:42 CEST 2012


On Thu, Jun 7, 2012 at 2:10 PM, PCB <pedrocontebarros at gmail.com> wrote:

> I have a dataset that represents measurements of fish density at a number of
> sampling locations at sea, in several different occasions (the sampling
> locations are not always the same), stored as a a list of
> SpatialPointsDataFrame objects.

 So your data is:

 Lat, Long, Time, Mass

> I want to calculate the center of mass of each distribution, to describe
> whether there is a trend in the overall distribution of the fish.

 What do you mean by 'each distribution'? Your second sentence makes
me think that Time is discreet, or can be grouped into discreet
'Occasions'.

> I have three main questions:
> a) Should I use the original points for calculating the centre of mass, or
> should I interpolate them first to a grid? I assume doing it on the original
> points will make the result dependent on the location of these points, that
> is really not linked to the underlying fish distribution

 Your data are samples from an underlying distribution of mass, so you
want to do something like Kriging to get an interpolated surface over
a grid.

> b) Should I reproject the data before calculating the center of mass (they
> are in lon-lat). If so, which projection should I use?

 If the Kriging package you use (and there's about 4 in R - gstat,
geoR, et al - read the Spatial Task View) can work out distances from
lat-long on the sphere (or ellipsoid) then you don't need to. However
computing distances from lat-long can be slower than from x-y
cartesian coords.. so...

 If your data are over a relatively small area then convert to a
cartesian coordinate system in metres for units and then all the
Kriging packages will work, and they'll compute distances using
Pythagoras.

 Now, which projection? Depends on the region you have data for. UTM
is a fairly safe bet, unless you're close to the poles, in which case
I think there must be polar projections. Check
www.spatialreference.org and see what turns up.


> c) A rectangular grid will include many locations on land, where no fish
> could have been recorded anyway. How do I get a grid I can use to
> meaningfully calculate the center of mass?

 I think most of the Kriging packages can mask the output region by a
polygon, or you can mask raster objects with rasters or clip them to
polygons.

> Thanks for your time, and any pointers will be highly appreciated.

 The Spatial Task View is the place to start!

Barry



More information about the R-sig-Geo mailing list