我有一个数据框架,我希望将其提升为空间数据,但其中有两对坐标-旅程原点地形测量栅格参考和旅程目的地地形测量栅格参考。
因此,我想将数据帧提升到空间,然后重新投影到WGS84。我可以用一对坐标来做到这一点:
# promote data frame to spatial
coordinates(myvar) = ~Easting + Northing
# give it the OS projection
proj4string(myvar)=CRS("+init=epsg:27700")
# convert projection to WGS84 as used by osm
我正在尝试将一些坐标从Lambert93重新投影到WGS84。我花了足够的时间寻找文档并更好地理解,但我还没有看到解决方案。
我在找一个能解释我哪里错了的人。
require(sp)
require(raster)
# >>>>>>>>>>>>>>>>>
# >>>>>>>>>>>>>>>>> I define the coordinates that I will use later
#
当我有几何point时,我想从起点(参照)计算最近的点。
出于这个原因,我使用ports.shp文件。
代码可以运行大部分time.But,有时会返回空的minDistPoint is null。我不确定用什么值来初始化minDist。
public Point findNearestPoint( Point p, SimpleFeatureCollection features ) throws FactoryException, TransformException {
Point destination = null;
double minDist = 10.0e+6;
我有一个带有坐标的相机陷阱数据的数据框(称为“事件”),并希望使用栅格文件为每个位置提取栖息地类型,并将栖息地类型添加到我的数据框中。我如何使用光栅和数据框坐标来提取它?之后如何将其添加到另一个主数据框架中? ## Creating the raster file from a shapefile
myfile <- shapefile("dpky.lc5.shp")
myfile@data$VALUE<-as.numeric(myfile@data$VALUE) # VALUE gives the numeric code for habitat type.
下面的代码使用了地图中心的绝对位置,但我想根据从KML文件引入的矢量图层特征来设置中心-这可能吗?我看过getCentroid,但是语法不正确?
map = new OpenLayers.Map("Map");
var mapnik = new OpenLayers.Layer.OSM();
//Set centre position converting from WGS to Mercator
var wgs84 = new OpenLayers.Projection("EPSG:4326");
var fromProjection = new OpenLa