harsha2010 / magellan

Geo Spatial Data Analytics on Spark
Apache License 2.0
534 stars 149 forks source link

Utility to convert shapes to GeoJSON #197

Closed halfabrane closed 6 years ago

halfabrane commented 6 years ago

adds a utility magellan.GeoJSON, along with a Spark SQL expression to convert shapes to GeoJSON geometries. A shape of the form Point(0.0, 0.5) will be converted to

{"type": "Point", "coords": [0.0, 0.5]}

Usage:

import magellan.GeoJSON
GeoJSON.writeJson(shape)

Usage in Spark SQL:

import org.apache.spark.sql.magellan.dsl.expressions._
df.withColumn("json",  $"point" asGeoJSON)
codecov-io commented 6 years ago

Codecov Report

Merging #197 into master will increase coverage by 0.26%. The diff coverage is 93.65%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #197      +/-   ##
==========================================
+ Coverage   89.57%   89.84%   +0.26%     
==========================================
  Files          48       49       +1     
  Lines        1564     1605      +41     
  Branches      103      112       +9     
==========================================
+ Hits         1401     1442      +41     
  Misses        163      163
Impacted Files Coverage Δ
src/main/scala/magellan/GeoJSONRelation.scala 100% <ø> (+11.11%) :arrow_up:
src/main/scala/magellan/geojson.scala 100% <100%> (ø)
src/main/scala/magellan/dsl/package.scala 82.35% <50%> (-4.32%) :arrow_down:
...che/spark/sql/catalyst/expressions/functions.scala 95.55% <86.36%> (-1.79%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 58ebcd9...9f5ea9b. Read the comment docs.