[R] Plotting gps coordinates on Shapefile
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Thu Jun 13 10:27:02 CEST 2013
On Thu, Jun 13, 2013 at 6:26 AM, L S <losedaghat at gmail.com> wrote:
> I realized that the coordinates are completely different. The coordinates
> in my data file (i.e. my csv file) are traditional GPS coordinates (e.g. 39.17
> or 76.37). The shapefile however has x,y values such as 1416813.54262877
> or 561125.546602725. I am not familiar with what type of coordinate system
> those values use.
>
> How can I change the coordinates in my csv file to match the same system as
> my shapefile or the other way around--i.e. to get my shapefile to have
> similar coordinates as my csv file?
You really need to know the coordinate reference system that your
points are in.
What you call "traditional GPS coordinates" is formally known as
EPSG:4326. I suspect your points are in some small-region plane
coordinate system. In the UK, for example, we have a square metric
grid system that is EPSG:27700. The units of this system are metres
from a point origin off the south-west of the UK, which is great for
small areas in the UK but not applicable to India, because it assumes
a flat earth. If your data is in the USA, then it might be one of the
state plane systems. There and elsewhere, it might be one of the
global UTM zones (but you have to know which one).
There are thousands of possible coordinate systems:
http://www.epsg-registry.org/ or you can make your own using PROJ4
strings...
To convert from one coordinate system to another, I normally use
spTransform from the rgdal package since I mostly work with sp-class
objects. I think there's a 'project' function that can work with raw
x-y coordinates in vectors or matrices.
You can also try asking on the R-sig-geo mailing list where the map
people hang out.
Barry
More information about the R-help
mailing list