简体   繁体   中英

How to get point coordinates in same projection as raster

I'm trying to plot some points on a raster (which has a OSGB36 projection), but the points x and y positions are in a different extent to the plotted raster. How can I get the points to be in the same coordinate system/extent as the raster, so they appear on the raster.

The raster layer crs:

extent      : 420000, 480000, 440000, 5e+05  (xmin, xmax, ymin, ymax)
coord. ref. : +proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +datum=OSGB36 +units=m +no_defs +ellps=airy +towgs84=446.448,-125.157,542.060,0.1502,0.2470,0.8421,-20.4894 

plotted raster:

在此处输入图片说明

Yet the x/y positions of the points (which are also in OSGB6) are:

54, -1.3

Any ideas on what I may have done wrong/how to fix it?

Thanks!

Your point seems to be in wgs84 geographical coordinates and not in projected Osgb6. You probably misspecified the crs in Arcgis. You need to modify the crs of your point. I assume your raster is called r :

pt <- data.frame(x=54,y= -1.3)
coordinates(pt) <- ~x+y
projection(pt) <- "+init:epsg=4326"
pt_osgb <- spTransform(pt, CRS(projection(r)))

By the way, you know that you can get coordinates of a point in R while using function locator(sp=TRUE) .

Sorry, I am with my smartphone, I cannot test this script but I think this may be the reason...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM