Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ WHERE
is_underground = FALSE
AND height IS NOT NULL
AND height > 20
AND ST_Intersects(geometry, ST_SetSRID(ST_GeomFromText('{nyc_bbox_wkt}'), 4326))
AND ST_Intersects(geometry, ST_GeomFromText('{nyc_bbox_wkt}', 4326))
LIMIT 5;
""").show()
```
Expand Down
2 changes: 1 addition & 1 deletion docs/crs-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"outputs": [],
"source": [
"cities = sd.sql(\"\"\"\n",
"SELECT city, ST_SetSRID(ST_GeomFromText(wkt), 3857) AS geometry FROM (VALUES\n",
"SELECT city, ST_GeomFromText(wkt, 3857) AS geometry FROM (VALUES\n",
" ('New York', 'POINT(-8238310.24 4969803.34)'),\n",
" ('Los Angeles', 'POINT(-13153204.78 4037636.04)'),\n",
" ('Chicago', 'POINT(-9757148.04 5138517.44)'))\n",
Expand Down
2 changes: 1 addition & 1 deletion docs/crs-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ We use the `ST_SetSRID` function to assign the correct CRS identifier to our geo

```python
cities = sd.sql("""
SELECT city, ST_SetSRID(ST_GeomFromText(wkt), 3857) AS geometry FROM (VALUES
SELECT city, ST_GeomFromText(wkt, 3857) AS geometry FROM (VALUES
('New York', 'POINT(-8238310.24 4969803.34)'),
('Los Angeles', 'POINT(-13153204.78 4037636.04)'),
('Chicago', 'POINT(-9757148.04 5138517.44)'))
Expand Down
4 changes: 2 additions & 2 deletions docs/overture-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@
" AND height > 20\n",
" AND ST_Intersects(\n",
" geometry,\n",
" ST_SetSRID(ST_GeomFromText('{nyc_bbox_wkt}'), 4326)\n",
" ST_GeomFromText('{nyc_bbox_wkt}', 4326)\n",
" )\n",
"LIMIT 5;\n",
"\"\"\").show()"
Expand Down Expand Up @@ -459,7 +459,7 @@
"WHERE\n",
" ST_Intersects(\n",
" geometry,\n",
" ST_SetSRID(ST_GeomFromText('{nova_scotia_bbox_wkt}'), 4326)\n",
" ST_GeomFromText('{nova_scotia_bbox_wkt}', 4326)\n",
" )\n",
"\"\"\").to_memtable()"
]
Expand Down
4 changes: 2 additions & 2 deletions docs/overture-examples.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ WHERE
AND height > 20
AND ST_Intersects(
geometry,
ST_SetSRID(ST_GeomFromText('{nyc_bbox_wkt}'), 4326)
ST_GeomFromText('{nyc_bbox_wkt}', 4326)
)
LIMIT 5;
""").show()
Expand Down Expand Up @@ -325,7 +325,7 @@ FROM division_area
WHERE
ST_Intersects(
geometry,
ST_SetSRID(ST_GeomFromText('{nova_scotia_bbox_wkt}'), 4326)
ST_GeomFromText('{nova_scotia_bbox_wkt}', 4326)
)
""").to_memtable()
```
Expand Down
2 changes: 1 addition & 1 deletion docs/programming-guide.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@
"ns = sd.sql(f\"\"\"\n",
"SELECT country, region, geometry\n",
"FROM division_area\n",
"WHERE ST_Intersects(geometry, ST_SetSRID(ST_GeomFromText('{nova_scotia_bbox_wkt}'), 4326))\n",
"WHERE ST_Intersects(geometry, ST_GeomFromText('{nova_scotia_bbox_wkt}', 4326))\n",
"\"\"\")\n",
"\n",
"ns.show(3)"
Expand Down
2 changes: 1 addition & 1 deletion docs/programming-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ nova_scotia_bbox_wkt = (
ns = sd.sql(f"""
SELECT country, region, geometry
FROM division_area
WHERE ST_Intersects(geometry, ST_SetSRID(ST_GeomFromText('{nova_scotia_bbox_wkt}'), 4326))
WHERE ST_Intersects(geometry, ST_GeomFromText('{nova_scotia_bbox_wkt}', 4326))
""")

ns.show(3)
Expand Down
4 changes: 2 additions & 2 deletions docs/reference/sql.md
Original file line number Diff line number Diff line change
Expand Up @@ -1419,7 +1419,7 @@ Since: v0.1.
#### SQL Example

```sql
SELECT ST_SetSRID(ST_GeomFromWKT('POINT (-64.363049 45.091501)'), 4326);
SELECT ST_GeomFromWKT('POINT (-64.363049 45.091501)', 4326);
```

## ST_SRID
Expand Down Expand Up @@ -1531,7 +1531,7 @@ Since: v0.1.

```sql
-- Transform a WGS84 polygon to UTM zone 49N
SELECT ST_Transform(ST_SetSRID(ST_GeomFromWkt('POLYGON((170 50,170 72,-130 72,-130 50,170 50))'), 4326), 'EPSG:32649');
SELECT ST_Transform(ST_GeomFromWkt('POLYGON((170 50,170 72,-130 72,-130 50,170 50))', 4326), 'EPSG:32649');
```

## ST_Translate
Expand Down
4 changes: 2 additions & 2 deletions python/sedonadb/python/sedonadb/udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

import inspect
from typing import Any, Literal, Optional, List, Union
from typing import Any, List, Literal, Optional, Union

from sedonadb._lib import sedona_scalar_udf
from sedonadb.utility import sedona # noqa: F401
Expand Down Expand Up @@ -172,7 +172,7 @@ def arrow_udf(
│ 0 │
└────────┘

>>> sd.sql("SELECT ST_SRID(shapely_udf(ST_SetSRID(ST_Point(0, 0), 3857), 2.0)) as col").show()
>>> sd.sql("SELECT ST_SRID(shapely_udf(ST_Point(0, 0, 3857), 2.0)) as col").show()
┌────────┐
│ col │
│ uint32 │
Expand Down
6 changes: 3 additions & 3 deletions python/sedonadb/tests/test_datasource.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
# specific language governing permissions and limitations
# under the License.

from pathlib import Path
import tempfile
from pathlib import Path

import geopandas
import geopandas.testing
import pandas as pd
import pytest
import shapely
import sedonadb
import shapely


def test_read_ogr_projection(con):
Expand Down Expand Up @@ -120,7 +120,7 @@ def test_read_ogr_filter(con):
con.sql(
"""
SELECT * FROM test_fgb
WHERE ST_Equals(wkb_geometry, ST_SetSRID(ST_Point(1, 2), 3857))
WHERE ST_Equals(wkb_geometry, ST_Point(1, 2, 3857))
"""
).to_pandas(),
gdf[gdf.geometry.geom_equals(shapely.Point(1, 2))].reset_index(drop=True),
Expand Down
4 changes: 2 additions & 2 deletions python/sedonadb/tests/test_udf.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ def test_udf_name():


def test_shapely_udf(con):
import shapely
import geoarrow.pyarrow as ga
import numpy as np
import shapely

@udf.arrow_udf(ga.wkb(), [udf.GEOMETRY, udf.NUMERIC])
def shapely_udf(geom, distance):
Expand All @@ -117,7 +117,7 @@ def shapely_udf(geom, distance):
# Ensure we can propagate a crs
pd.testing.assert_frame_equal(
con.sql(
"SELECT ST_SRID(shapely_udf(ST_SetSRID(ST_Point(0, 0), 3857), 2.0)) as col"
"SELECT ST_SRID(shapely_udf(ST_Point(0, 0, 3857), 2.0)) as col"
).to_pandas(),
pd.DataFrame({"col": [3857]}, dtype=np.uint32),
)
Expand Down
2 changes: 1 addition & 1 deletion r/sedonadb/R/dataframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ sd_preview <- function(.data, n = NULL, ascii = NULL, width = NULL) {
#' @examples
#' tmp_parquet <- tempfile(fileext = ".parquet")
#'
#' sd_sql("SELECT ST_SetSRID(ST_Point(1, 2), 4326) as geom") |>
#' sd_sql("SELECT ST_Point(1, 2, 4326) as geom") |>
#' sd_write_parquet(tmp_parquet)
#'
#' sd_read_parquet(tmp_parquet)
Expand Down
2 changes: 1 addition & 1 deletion r/sedonadb/README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ filter <- "POLYGON ((-73.4341 44.0087, -73.4341 43.7981, -73.2531 43.7981, -73.2

sd_sql(glue::glue("
SELECT * FROM buildings
WHERE ST_Intersects(ST_SetSRID(ST_GeomFromText('{filter}'), 4326), geometry)
WHERE ST_Intersects(ST_GeomFromText('{filter}', 4326), geometry)
")) |> sd_preview()
```

Expand Down
2 changes: 1 addition & 1 deletion r/sedonadb/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ filter <- "POLYGON ((-73.4341 44.0087, -73.4341 43.7981, -73.2531 43.7981, -73.2

sd_sql(glue::glue("
SELECT * FROM buildings
WHERE ST_Intersects(ST_SetSRID(ST_GeomFromText('{filter}'), 4326), geometry)
WHERE ST_Intersects(ST_GeomFromText('{filter}', 4326), geometry)
")) |> sd_preview()
#> ┌─────────────────────────────────┐
#> │ geometry │
Expand Down
2 changes: 1 addition & 1 deletion r/sedonadb/man/sd_write_parquet.Rd

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

4 changes: 2 additions & 2 deletions r/sedonadb/tests/testthat/test-context.R
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ test_that("views can be created and dropped", {
})

test_that("scalar udfs can be registered", {
udf <- ctx()$scalar_udf_xptr("st_point")
udf <- ctx()$scalar_udf_xptr("st_envelope")
expect_s3_class(udf, "datafusion_scalar_udf")

sd_register_udf(udf)
df <- sd_sql("SELECT ST_Point(0, 1) as geom") |> sd_collect()
df <- sd_sql("SELECT ST_Envelope(ST_Point(0, 1)) as geom") |> sd_collect()
expect_identical(
wk::as_wkt(df$geom),
wk::wkt("POINT (0 1)")
Expand Down
4 changes: 2 additions & 2 deletions r/sedonadb/tests/testthat/test-dataframe.R
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ test_that("sd_write_parquet can sort data", {

test_that("sd_write_parquet can write geometry data", {
df <- sd_sql(
"SELECT ST_SetSRID(ST_Point(1, 2), 4326) as geom, 'test' as name"
"SELECT ST_Point(1, 2, 4326) as geom, 'test' as name"
)

tmp_parquet_file <- tempfile(fileext = ".parquet")
Expand All @@ -261,7 +261,7 @@ test_that("sd_write_parquet can write geometry data", {

test_that("sd_write_parquet validates geoparquet_version parameter", {
df <- sd_sql(
"SELECT ST_SetSRID(ST_Point(1, 2), 4326) as geom, 'test' as name"
"SELECT ST_Point(1, 2, 4326) as geom, 'test' as name"
)
tmp_parquet_file <- tempfile(fileext = ".parquet")
on.exit(unlink(tmp_parquet_file))
Expand Down
4 changes: 1 addition & 3 deletions rust/sedona-functions/src/st_setsrid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,7 @@ fn set_srid_doc() -> Documentation {
)
.with_argument("geom", "geometry: Input geometry or geography")
.with_argument("srid", "srid: EPSG code to set (e.g., 4326)")
.with_sql_example(
"SELECT ST_SetSRID(ST_GeomFromWKT('POINT (-64.363049 45.091501)'), 4326)".to_string(),
)
.with_sql_example("SELECT ST_GeomFromWKT('POINT (-64.363049 45.091501)', 4326)".to_string())
.build()
}

Expand Down
Loading