paleolimbot opened a new pull request, #660:
URL: https://github.com/apache/sedona-db/pull/660

   This PR adds support for literal conversion for the three CRS-like objects I 
know about, the main one being `pyproj.CRS()`. This is a nice quality of life 
improvement for writing SQL against GeoPandas data frames. For example, this is 
finding all the points within 10 km of some lon/lat:
   
   ```python
   import geopandas
   import sedona.db
   
   url = 
"https://github.com/geoarrow/geoarrow-data/releases/download/v0.2.0/ns-water_water-point.fgb";
   gdf = geopandas.read_file(url)
   
   sd = sedona.db.connect()
   sd.create_data_frame(gdf).to_view("gdf", overwrite=True)
   
   sd.sql("""
       SELECT "OBJECTID", "FEAT_CODE", geometry FROM gdf
       WHERE ST_DWithin(ST_Transform(ST_Point(-64, 45, 4326), $1), geometry, 
10000)
   """, params=(gdf.crs,)).show()
   #> 
┌──────────┬───────────┬─────────────────────────────────────────────────────────────────┐
   #> │ OBJECTID ┆ FEAT_CODE ┆                             geometry             
               │
   #> │   int64  ┆    utf8   ┆                             geometry             
               │
   #> 
╞══════════╪═══════════╪═════════════════════════════════════════════════════════════════╡
   #> │    18927 ┆ WAFA60    ┆ POINT Z(428474.02329999954 4984050.078299999 
77.89999999999418) │
   #> 
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │    18915 ┆ WADM60    ┆ POINT Z(421205.36319999956 4983412.968 
22.89999999999418)       │
   #> 
├╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌┼╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌┤
   #> │    17112 ┆ WAFA60    ┆ POINT Z(418256.42310000025 4975386.877800001 
71.80000000000291) │
   #> 
└──────────┴───────────┴─────────────────────────────────────────────────────────────────┘
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to