On Thu, Jun 13, 2013 at 6:26 AM, L S <losedag...@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 ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.