Quantcast

plotting points to a map

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

plotting points to a map

wudadan
Dear R users,

I have a city map in shape file (polygon). I also have some points that I
hope to plot them to the city map. The only information I have about those
points are their relative longitude and latitude to the city center by
miles. Is there a way that R can help me to do this? Thanks.

Gary

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plotting points to a map

Sarah Goslee
Hi,

On Wed, Jul 18, 2012 at 2:11 PM, Gary Dong <[hidden email]> wrote:
> Dear R users,
>
> I have a city map in shape file (polygon). I also have some points that I
> hope to plot them to the city map.

What projection is the shape file in? Have you successfully imported
it into R yet?

This page has a nice overview on dealing with shapefiles in R.

http://www.nceas.ucsb.edu/scicomp/usecases/ReadWriteESRIShapeFiles


> The only information I have about those
> points are their relative longitude and latitude to the city center by
> miles. Is there a way that R can help me to do this? Thanks.

What does "relative longitude and latitude in miles" mean? That makes
no sense to me. Do you mean distance and direction? (Which wouldn't be
latitude and longitude.)

If the latter, do you know the coordinates of the reference point?

I think we need more information to be able to help. You might also be
better served by asking on the r-sig-geo list instead of the main
R-help list.

Sarah

--
Sarah Goslee
http://www.functionaldiversity.org

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plotting points to a map

wudadan
Thanks, Sara.

For your first question:

Geographic Coordinate System: GCS_North_American_1983_HARN

Projected Coordinate System:
NAD_1983_HARN_StatePlane_Oregon_North_FIPS_3601_Feet_Intl

I have imported the shp file in R by read.shaplefiles().

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.

Thanks.

Best
Gary


On Wed, Jul 18, 2012 at 11:30 AM, Sarah Goslee <[hidden email]>wrote:

> Hi,
>
> On Wed, Jul 18, 2012 at 2:11 PM, Gary Dong <[hidden email]> wrote:
> > Dear R users,
> >
> > I have a city map in shape file (polygon). I also have some points that I
> > hope to plot them to the city map.
>
> What projection is the shape file in? Have you successfully imported
> it into R yet?
>
> This page has a nice overview on dealing with shapefiles in R.
>
> http://www.nceas.ucsb.edu/scicomp/usecases/ReadWriteESRIShapeFiles
>
>
> > The only information I have about those
> > points are their relative longitude and latitude to the city center by
> > miles. Is there a way that R can help me to do this? Thanks.
>
> What does "relative longitude and latitude in miles" mean? That makes
> no sense to me. Do you mean distance and direction? (Which wouldn't be
> latitude and longitude.)
>
> If the latter, do you know the coordinates of the reference point?
>
> I think we need more information to be able to help. You might also be
> better served by asking on the r-sig-geo list instead of the main
> R-help list.
>
> Sarah
>
> --
> Sarah Goslee
> http://www.functionaldiversity.org
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: plotting points to a map

Barry Rowlingson
In reply to this post by Sarah Goslee
On Wed, Jul 18, 2012 at 7:41 PM, Gary Dong <[hidden email]> 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

______________________________________________
[hidden email] 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.
Loading...