Grokbase Groups R r-sig-geo June 2012
FAQ
Dear list,

I have a large set of locations scattered over a land area covering about 200,000 km?. That area borders the sea, and I'd like to find the shortest distance from each point location to the sea/coast. Point locations are in lat/long.

I've turned the locations into a SpatialPoints object, with a proj4string. And I have a SpatialPolygons object consisting of a single polygon, defining the sea areas (same proj4string as for the SpatialPoints object).

My problem is I'm not clear on the next step. I tried using "gDistance" from the "rgeos" package:

dists <- gDistance(locations, sea)

but got two warnings:

Warning messages:
1: In RGEOSDistanceFunc(spgeom1, spgeom2, byid, "rgeos_distance") :
Spatial object 1 is not projected; GEOS expects planar coordinates
2: In RGEOSDistanceFunc(spgeom1, spgeom2, byid, "rgeos_distance") :
Spatial object 2 is not projected; GEOS expects planar coordinates

So should I set the proj4string to NA? And/or is gDistance even the right tool for this job? Maybe it's designed for instances where distances are small, not in the hundreds of kilometres?

Any advice on how to do this appropriately would be much appreciated.

- Malcolm

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 5 | next ›
Discussion Overview
groupr-sig-geo @
categoriesr
postedJun 13, '12 at 12:46p
activeJun 13, '12 at 10:15p
posts5
users3
websiter-project.org
irc#r

People

Translate

site design / logo © 2022 Grokbase