[R] plotting points to a map
Barry Rowlingson
b.rowlingson at lancaster.ac.uk
Wed Jul 18 22:35:33 CEST 2012
On Wed, Jul 18, 2012 at 7:41 PM, Gary Dong <pdxgary163 at gmail.com> wrote:
> For your second question:
> 1) by relative long and lat, I mean distances to the city center from
> south-north and east-west directions.
> 2) I know the coordinate of the reference point.
The problem here is that going 10 miles north along a line of
longitude then going 5 miles east along a line of latitude doesn't get
you to the same point as first going 5 miles east along a line of
latitude and then going 10 miles north on the line of longitude you
reach. If you don't believe me, try doing it 12 miles due south of the
north pole.
To be precise, if someone tells you X miles north and Y miles east of
point Z, then they have to specify the projected coordinate system
they are talking about - this should be an approximation to a square
grid valid to a certain precision.
Now maybe the projected coord system you mentioned is the right one
for your points. Maybe your city map is already in that projection.
When you plot the city shapefile, are the axis values in lat-long
degrees or could they be feet?
require(rgdal)
city = readOGR(".","city") # should read city.shp in the current directory
bbox(city)
if that is in feet, then city.shp is already projected, and all you
need to do is add the north and east offsets converted to feet to the
projected coordinate of your origin point...
Barry
More information about the R-help
mailing list