I'm using gDistance from the rgeos package for R to find the nearest point to a polygon. The projection of both points and the polygon is +proj=longlat +datum=WGS84 +no_defs +ellps=WGS84 +towgs84=0,0,0. My code looks something like this:
min(gDistance(MyPolygon, MyPoints, byid=TRUE)) Running this gives a result and the following 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 My understanding of this is that gDistance isn't happy with my projection (or lack thereof). The actual magnitude of the result isn't important, just that the point is indeed the closest point to the polygon. My question is will this result change if I change the projection? That is, regardless of the actual numeric value of the distance between the polygon and point, will the same point be identified as being closest if I changed the projection?
أكثر...
min(gDistance(MyPolygon, MyPoints, byid=TRUE)) Running this gives a result and the following 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 My understanding of this is that gDistance isn't happy with my projection (or lack thereof). The actual magnitude of the result isn't important, just that the point is indeed the closest point to the polygon. My question is will this result change if I change the projection? That is, regardless of the actual numeric value of the distance between the polygon and point, will the same point be identified as being closest if I changed the projection?
أكثر...