You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We will summarize the change in NDVI over 2018 in the Cuyahoga Valley National Park in Ohio, USA. First, we will retrieve open vector data delineating the park boundary from the US National Park Service's LandsNet.
22
29
30
+
## Vector Data
31
+
32
+
First we will get the vector data from LandsNet service by a REST query. The data is saved to a geojson file.
Now we read the park boundary vector data as a Spark DataFrame using the built-in @ref:[geojson DataSource](vector-data.md#geojson-datasource). The geometry is very detailed, and the EO cells are relatively coarse. To speed up the processing, the geometry is "simplified" by combining vertices within about 100 meters of each other. For more on this see the section on Shapely support in @ref:[user defined functions](vector-data.md#shapely-geometry-support).
38
64
39
-
The entire park boundary is contained in MODIS granule h11 v4. We will simply filter on this granule, rather than using a @ref:[spatial relation](vector-data.md#geomesa-functions-and-spatial-relations). The time period selected should show the change in plant vigor as leaves emerge over the spring and into early summer.
The entire park boundary is contained in MODIS granule h11 v04. We will simply filter on this granule, rather than using a @ref:[spatial relation](vector-data.md#geomesa-functions-and-spatial-relations). The time period selected should show the change in plant vigor as leaves emerge over the spring and into early summer.
40
80
41
81
```python query_catalog
42
-
from pyspark.sql.functions import lit
43
-
park_cat = cat.filter(
82
+
park_cat = cat \
83
+
.filter(
44
84
(cat.granule_id == 'h11v04') &
45
85
(cat.acquisition_date > lit('2018-02-19')) &
46
-
(cat.acquisition_date < lit('2018-07-01'))
47
-
)
86
+
(cat.acquisition_date < lit('2018-07-01'))
87
+
) \
88
+
.crossJoin(park_vector)
89
+
48
90
park_cat.printSchema()
49
91
```
50
92
51
-
## Catalog Read
52
-
53
93
Now we have a catalog with several months of MODIS data for a single granule. However, the granule is larger than our park boundary. We will combine the park geometry with the catalog, and read only the bands of interest to compute NDVI, which we discussed in a @ref:[previous section](local-algebra.md#computing-ndvi).
54
94
95
+
We then [reproject](https://gis.stackexchange.com/questions/247770/understanding-reprojection) the park geometry to the same @ref:[CRS](concepts.md#coordinate-reference-system--crs-) as the imagery. Then we will filter to only the _tiles_ intersecting the park.
96
+
55
97
```python read_catalog
56
98
raster_cols = ['B01', 'B02',] # red and near-infrared respectively
@@ -70,14 +116,12 @@ Now we have the vector representation of the park boundary alongside the _tiles_
70
116
We do this using two transformations. The first one will reproject the park boundary from coordinates to the MODIS sinusoidal projection. The second one will create a new _tile_ aligned with the imagery containing a value of 1 where the pixels are contained within the park and NoData elsewhere.
0 commit comments