我将CSV文件中的一组点加载到RDD:
case class yieldrow(Elevation:Double,DryYield:Double)
val points :RDD[PointFeature[yieldrow]] = lines.map { line =>
val fields = line.split(",")
val point = Point(fields(1).toDouble,fields(0).toDouble)
Feature(point, yieldrow(fields(4).toDouble,fields(20)))
}那就得到:
points: org.apache.spark.rdd.RDD[geotrellis.vector.PointFeature[yieldrow]] 现在需要重新设计EPSG:4326到EPSG:3270
因此,我创建CRS是为了:
val crsFrom : geotrellis.proj4.CRS = geotrellis.proj4.CRS.fromName("EPSG:4326")
val crsTo : geotrellis.proj4.CRS = geotrellis.proj4.CRS.fromEpsgCode(32720)但是我不能创造出转化,我也不知道:
将转换应用于单个点是很热的:
val pt = Point( -64.9772376007928, -33.6408083223936)如何使用特征的mapGeom方法进行CRS转换?
points.map(_.mapGeom(?????))
points.map(feature => feature.mapGeom(????))如何使用ReprojectPointFeature(切入点)?
这些文档没有基本的代码示例。
任何帮助都将不胜感激。
发布于 2017-11-13 06:05:24
我将从最后一个问题开始:
实际上,要在PointFeature上执行重新项目,可以使用ReprojectPointFeature内嵌案例类。要使用它,只需确保import geotrellis.vector._在reproject函数调用作用域中。
import geotrellis.vector._
points.map(_.reproject(crsFrom, crsTo))同样的导入也适用于Point:
import geotrellis.vector._
pt.reproject(crsFrom, crsTo)
points.map(_.mapGeom(_.reproject(crsFrom, crsTo)))https://stackoverflow.com/questions/47255212
复制相似问题