Skip to content

Commit 36be700

Browse files
authored
Merge pull request #328 from s22s/docs/fix-vector-job-heap-space
Docs/fix vector job heap space
2 parents ba3d30d + 5bcbb79 commit 36be700

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pyrasterframes/src/main/python/docs/vector-data.pymd

+9-6
Original file line numberDiff line numberDiff line change
@@ -79,18 +79,21 @@ from pyrasterframes.rasterfunctions import st_centroid
7979
df.select(df.state_code, inefficient_centroid(df.geometry), st_centroid(df.geometry))
8080
```
8181

82-
The RasterFrames vector functions and GeoMesa functions also provide a variety of spatial relations that are useful in combination with the geometric properties of projected rasters. In this example, we use the @ref:[built-in Landsat catalog](raster-catalogs.md#using-built-in-experimental-catalogs) which provides an extent. We will convert the extent to a polygon and filter to those within approximately 500 km of a selected point.
82+
The RasterFrames vector functions and GeoMesa functions also provide a variety of spatial relations that are useful in combination with the geometric properties of projected rasters. In this example, we use the @ref:[built-in Landsat catalog](raster-catalogs.md#using-built-in-experimental-catalogs) which provides an extent. We will convert the extent to a polygon and filter to those within approximately 50 km of a selected point.
8383

84-
```python, evaluate=True
84+
```python, spatial_relation, evaluate=True
8585
from pyrasterframes.rasterfunctions import st_geometry, st_bufferPoint, st_intersects, st_point
8686
from pyspark.sql.functions import lit
8787
l8 = spark.read.format('aws-pds-l8-catalog').load()
8888

89-
l8 = l8.withColumn('geom', st_geometry(l8.bounds_wgs84))
90-
l8 = l8.withColumn('paducah', st_point(lit(-88.6275), lit(37.072222)))
89+
l8 = l8.withColumn('geom', st_geometry(l8.bounds_wgs84)) # extent to polygon
90+
l8 = l8.withColumn('paducah', st_point(lit(-88.628), lit(37.072))) # col of points
9191

92-
l8_filtered = l8.filter(st_intersects(l8.geom, st_bufferPoint(l8.paducah, lit(500000.0))))
93-
l8_filtered.select('product_id', 'entity_id', 'acquisition_date', 'cloud_cover_pct')
92+
l8_filtered = l8 \
93+
.filter(st_intersects(l8.geom, st_bufferPoint(l8.paducah, lit(50000.0)))) \
94+
.filter(l8.acquisition_date > '2018-02-01') \
95+
.filter(l8.acquisition_date < '2018-04-01')
96+
l8_filtered.select('product_id', 'entity_id', 'acquisition_date', 'cloud_cover_pct').toPandas()
9497
```
9598

9699
[GeoPandas]: http://geopandas.org

0 commit comments

Comments
 (0)