Skip to content

Commit

Permalink
Merge branch 'release/4.0.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadain committed Jan 31, 2020
2 parents 0f93ab6 + c3313a9 commit d258dad
Show file tree
Hide file tree
Showing 6 changed files with 91 additions and 61 deletions.
16 changes: 15 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## 4.0.2

- Update `/run` and `/multi` endpoints to take a set of
shapes and a list of rasters with differring extents,
such that the spatial keys from one raster may not be
available in another one. Previously this would cause
a 500 with the following error:

java.util.NoSuchElementException: key not found: SpatialKey(66,132)

Now we use an empty tile with NODATA values instead:

"List(21, -2147483648)": 8,

## 4.0.1

- Update `/multi` endpoint to take a set of shapes and a
Expand Down Expand Up @@ -25,7 +39,7 @@
once for the entire set of shapes and reusing the fetched
tiles, we reduce the time taken to process a large number
of shapes by almost an order of magnitude.

This new endpoint supports `RasterGroupedCount`,
`RasterAverage`, `RasterGroupedAverage`, and
`RasterLinesJoin`. It does not support `RasterSummary`
Expand Down
4 changes: 3 additions & 1 deletion api/src/main/scala/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,12 @@ trait Utils {
def joinCollectionLayers(
layers: Seq[TileLayerCollection[SpatialKey]]
): Map[SpatialKey, Seq[Tile]] = {
val layout = layers.head.metadata.layout
lazy val emptyTile = IntConstantTile(NODATA, layout.tileCols, layout.tileRows)
val maps: Seq[Map[SpatialKey, Tile]] = layers.map((_: Seq[(SpatialKey, Tile)]).toMap)
val keySet: Array[SpatialKey] = maps.map(_.keySet).reduce(_ union _).toArray
for (key: SpatialKey <- keySet) yield {
val tiles: Seq[Tile] = maps.map(_.apply(key))
val tiles: Seq[Tile] = maps.map(_.getOrElse(key, emptyTile))
key -> tiles
}
}.toMap
Expand Down
15 changes: 15 additions & 0 deletions examples/EmptyTileRequest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"input": {
"operationType": "RasterGroupedCount",
"polygon": [
"{\"type\": \"MultiPolygon\", \"coordinates\": [[[[-112.08207045850068, 33.44327615726762], [-112.07129563036652, 33.44327615726762], [-112.07129563036652, 33.45226655104027], [-112.08207045850068, 33.45226655104027], [-112.08207045850068, 33.44327615726762]]]]}"
],
"polygonCRS": "LatLng",
"rasterCRS": "ConusAlbers",
"rasters": [
"nlcd-2011-30m-epsg5070-512-int8",
"ara-30m-epsg5070-512"
],
"zoom": 0
}
}
2 changes: 1 addition & 1 deletion project/build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ object Geoprocessing extends Build {
super.settings ++
Seq(
shellPrompt := { s => Project.extract(s).currentProject.id + " > " },
version := "4.0.1",
version := "4.0.2",
scalaVersion := Version.scala,
organization := "org.wikiwatershed.mmw.geoprocessing",
name := "mmw-geoprocessing",
Expand Down
4 changes: 2 additions & 2 deletions scripts/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "pypi"

[packages]

requests = "==2.18.4"
requests = "==2.20.0"
aiohttp = "==3.0.9"
backoff = "==1.4.3"

Expand All @@ -18,4 +18,4 @@ backoff = "==1.4.3"

[requires]

python_version = "3.6"
python_version = "3"
111 changes: 55 additions & 56 deletions scripts/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit d258dad

Please sign in to comment.