Repository navigation
Add Support for GeoTools SimpleFeature - #1495
Conversation
e0ad08c to
fe68ed3
Compare
| "org.geotools" % "gt-coverage" % Version.geotools, | ||
| "org.geotools" % "gt-geotiff" % Version.geotools, | ||
| "org.geotools" % "gt-epsg-hsql" % Version.geotools, | ||
| "org.apache.spark" %% "spark-core" % Version.spark % "provided", |
There was a problem hiding this comment.
This doesn't seem to be used.
There was a problem hiding this comment.
Indeed, the first few commits of this PR were taken from my other GeoTools-related PR. When the GridCoverage2D stuff that Rob is working on goes in, I will rebase and this will go away.
fe68ed3 to
4aa2876
Compare
7b28582 to
1746e54
Compare
|
This API should be refactored to follow the Client side view of the API should be e.g. val point: Point = ???
val crs: CRS = ???
val data: Map[(String, Any)] = ???
point.toSimpleFeature()
point.toSimpleFeature(crs)
point.toSimpleFeature(crs, data)
point.toSimpleFeature(data)
val simpleFeature: SimpleFeature = ???
val point: Point = simpleFeature.toGeometry[Point]
val geom: Geometry = simpleFeature.toGeometry[Geometry]
val pointFeature: PointFeature[Map[String, Object]] = simpleFeature.toFeature[Point]
// this opens the door for an implicit that converts the map to a case class, e.g.
case class Foo(x: Int, y: String)
implicit def mapToFoo(map: Map[String, Object]): Foo = ???
val pointFeature: PointFeature[Foo] = simpleFeature.toFeature[Point, Foo](mapToFoo) // mapToFoo implicit param |
|
Okay, I will see if I can put those changes in soon. |
1746e54 to
a4cc264
Compare
|
I believe that all comments prior to this one have been addressed. |
| } | ||
| } | ||
|
|
||
| def apply(simpleFeature: SimpleFeature): Feature[Geometry, immutable.Map[String, Object]] = { |
There was a problem hiding this comment.
We should have this typed on [G <: Geometry: ClassTag] then use a combination of
and
To return the correct type.
Then the asInstanceOf cast below gets pushed down into the moment we translate from a JTS geometry.
We could call SimpleFeatureToFeature[Geometry] to keep the most generic type
|
I believe that all comments prior to this one have been addressed. |
| } | ||
| } | ||
|
|
||
| def apply[G <: Geometry : ClassTag](simpleFeature: SimpleFeature): Feature[G, immutable.Map[String, Object]] = { |
There was a problem hiding this comment.
I wonder about our ability to pull off a roundtrip without an inverse of the transmute function defined for the Feature -> SimpleFeature translation
The shapefile test data were taken from the [GeoTools tree](https://github.com/geotools/geotools) commit 2e54bd5.
519c7a4 to
6868341
Compare
|
|
|
+1 |
In this pull request, support is added for converting GeoTools
SimpleFeatures into GeotrellisFeatureobjects and vice-versa.Still Needs