SPARK_SUBMIT="spark-1.5.2/bin/spark-submit"
# To generate the assembly run:
# git clone https://github.com/pomadchin/geotrellis-chatta-demo.git
# cd geotrellis-chatta-demo
# git checkout spark-version
# ./sbt assembly
# Note: it may be necessary to run ./publish-local.sh on geotrellis repository before
JAR="geotrellis-chatta-demo/geotrellis/target/scala-2.10/GeoTrellis-Tutorial-Project-assembly-0.1-SNAPSHOT.jar"
# Amount of memory for the driverDRIVER_MEMORY=3G
# Amount of memory per executor. If in local mode, change the DRIVER_MEMORY instead.EXECUTOR_MEMORY=4G
# MASTER# For local ingest, options are "local" or "local[K]", where K is the number of executors, e.g. "local[8]"MASTER=local[*]
# Name of the layer. This will be used in conjunction with the zoom level to reference the layer (see LayerId)LAYER_NAME=madrid
# This defines the destination spatial reference system we want to useCRS=EPSG:4326
LAYOUT_SCHEME="tms" # Not very sure about how to define the layout scheme
# Directory with the input tiled GeoTIFF'sINPUT=file:///catalog/madrid/madrid.tif
# Catalog directory on HDFSOUTPUT=hdfs://localhost:8020/catalog
# Remove some bad signatures from the assembled JARzip -d $JAR META-INF/ECLIPSEF.RSA > /dev/nullzip -d $JAR META-INF/ECLIPSEF.SF > /dev/null
$SPARK_SUBMIT \--class geotrellis.chatta.ChattaIngest \--master $MASTER \--driver-memory $DRIVER_MEMORY \--executor-memory $EXECUTOR_MEMORY \$JAR \--input hadoop --format geotiff --cache NONE -I path=$INPUT \--output hadoop -O path=$OUTPUT \--layer $LAYER_NAME --crs $CRS --layoutScheme $LAYOUT_SCHEME
<repositories> <repository> <snapshots> <enabled>false</enabled> </snapshots> <id>bintray-azavea-geotrellis</id> <name>bintray</name> <url>http://dl.bintray.com/azavea/geotrellis</url> </repository> </repositories>
<dependencies> <dependency> <groupId>com.azavea.geotrellis</groupId> <artifactId>geotrellis-spark-etl_2.10</artifactId> <version>0.10.0-b3b859d</version> </dependency> </dependencies>
def readTiles(sc: SparkContext, source: String, scheme: LayoutScheme = DEFAULT_SCHEME): RasterRDD[SpatialKey] = {
val tiff = readGeoTiff(sc, source)
val (_, sourceMetadata) = RasterMetaData.fromRdd(tiff, scheme)
val metadata = snappedMetaData(sourceMetadata)
ContextRDD(tiff.tileToLayout(sourceMetadata), metadata)
}
def snappedMetaData(metadata: RasterMetaData): RasterMetaData = {
val gridBounds = metadata.mapTransform(metadata.extent)
val snapExtent = metadata.mapTransform(gridBounds)
val RasterMetaData(_, LayoutDefinition(_, tileLayout), _, _) = metadata
val layout = LayoutDefinition(snapExtent, tileLayout)
RasterMetaData(metadata.cellType, layout, snapExtent, metadata.crs)
}
def readGeoTiff(sc: SparkContext, source: String): RDD[(ProjectedExtent, Tile)] = {
// Read the geotiff in as a single image RDD,
// using a method implicitly added to SparkContext by
// an implicit class available via the
// "import geotrellis.spark.io.hadoop._ " statement.
sc.hadoopGeoTiffRDD(source)
}
HadoopLayerReader.spatial(catalogPath)(sc).read(LayerId("myraster", 1))
HadoopLayerReader.spatial(catalogPath)(sc).read(LayerId("myraster",1))
--
You received this message because you are subscribed to the Google Groups "geotrellis-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to geotrellis-us...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
HadoopLayerWriter.spatial(regionPath(region), HilbertKeyIndexMethod)(sc).write(LayerId("myraster",1), tiles)