Skip to content

Commit

Permalink
Use modern syntax of ST_Point
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-jts committed Nov 1, 2024
1 parent 170cd3c commit 080a901
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ BEGIN
args AS (
SELECT
ST_TileEnvelope(z, x, y) AS bounds,
ST_Transform(ST_SetSRID(ST_MakePoint(click_lon, click_lat), 4326), 26910) AS click
ST_Transform(ST_Point(click_lon, click_lat, 4326), 26910) AS click
),
mvtgeom AS (
SELECT
Expand Down Expand Up @@ -533,7 +533,7 @@ COMMENT ON FUNCTION public.parcels_in_radius IS 'Given the click point (click_lo
```
Notes:
* The parcels are stored in a table with spatial reference system [3005](https://epsg.io/3005), a planar projection.
* The click parameters are longitude/latitude, so in building a click geometry (`ST_MakePoint()`) to use for querying, we transform the geometry to the table spatial reference.
* The click parameters are longitude/latitude, so in building a click geometry (`ST_Point()`) to use for querying, we transform the geometry to the table spatial reference.
* To get the parcel boundaries clipped to the radius, we build a circle in the native spatial reference (26910) using the `ST_Buffer()` function on the click point, then intersect that circle with the parcels.

#### Dynamic Geometry Example
Expand Down Expand Up @@ -617,13 +617,13 @@ cx float8 := 1.5*i*edge;
cy float8 := h*(2*j+abs(i%2));
BEGIN
RETURN ST_MakePolygon(ST_MakeLine(ARRAY[
ST_MakePoint(cx - 1.0*edge, cy + 0),
ST_MakePoint(cx - 0.5*edge, cy + -1*h),
ST_MakePoint(cx + 0.5*edge, cy + -1*h),
ST_MakePoint(cx + 1.0*edge, cy + 0),
ST_MakePoint(cx + 0.5*edge, cy + h),
ST_MakePoint(cx - 0.5*edge, cy + h),
ST_MakePoint(cx - 1.0*edge, cy + 0)
ST_Point(cx - 1.0*edge, cy + 0),
ST_Point(cx - 0.5*edge, cy + -1*h),
ST_Point(cx + 0.5*edge, cy + -1*h),
ST_Point(cx + 1.0*edge, cy + 0),
ST_Point(cx + 0.5*edge, cy + h),
ST_Point(cx - 0.5*edge, cy + h),
ST_Point(cx - 1.0*edge, cy + 0)
]));
END;
$$
Expand Down
2 changes: 1 addition & 1 deletion examples/openlayers/openlayers-function-click.sql
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ AS $$
WITH hydrants_near AS (
SELECT *
FROM hydrants
ORDER BY geom <-> ST_Transform(ST_SetSRID(ST_MakePoint(lon, lat),4326),26910)
ORDER BY geom <-> ST_Transform(ST_Point(lon, lat, 4326),26910)
LIMIT count
),
-- Convert the tile coordinates to an actual box
Expand Down
14 changes: 7 additions & 7 deletions hugo/content/usage/function-layers-advanced.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,13 +87,13 @@ cx float8 := 1.5*i*edge;
cy float8 := h*(2*j+abs(i%2));
BEGIN
RETURN ST_MakePolygon(ST_MakeLine(ARRAY[
ST_MakePoint(cx - 1.0*edge, cy + 0),
ST_MakePoint(cx - 0.5*edge, cy + -1*h),
ST_MakePoint(cx + 0.5*edge, cy + -1*h),
ST_MakePoint(cx + 1.0*edge, cy + 0),
ST_MakePoint(cx + 0.5*edge, cy + h),
ST_MakePoint(cx - 0.5*edge, cy + h),
ST_MakePoint(cx - 1.0*edge, cy + 0)
ST_Point(cx - 1.0*edge, cy + 0),
ST_Point(cx - 0.5*edge, cy + -1*h),
ST_Point(cx + 0.5*edge, cy + -1*h),
ST_Point(cx + 1.0*edge, cy + 0),
ST_Point(cx + 0.5*edge, cy + h),
ST_Point(cx - 0.5*edge, cy + h),
ST_Point(cx - 1.0*edge, cy + 0)
]));
END;
$$
Expand Down
4 changes: 2 additions & 2 deletions hugo/content/usage/function-layers.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ AS $$
args AS (
SELECT
ST_TileEnvelope(z, x, y) AS bounds,
ST_Transform(ST_SetSRID(ST_MakePoint(click_lon, click_lat), 4326), 26910) AS click
ST_Transform(ST_Point(click_lon, click_lat, 4326), 26910) AS click
),
mvtgeom AS (
SELECT
Expand Down Expand Up @@ -157,5 +157,5 @@ COMMENT ON FUNCTION public.parcels_in_radius IS 'Given the click point (click_lo
Notes:

* The parcels are stored in a table with spatial reference system [3005](https://epsg.io/3005), a planar projection.
* The click parameters are longitude/latitude, so in building a click geometry (`ST_MakePoint()`) to use for querying, we transform the geometry to the table spatial reference.
* The click parameters are longitude/latitude, so in building a click geometry (`ST_Point()`) to use for querying, we transform the geometry to the table spatial reference.
* To get the parcel boundaries clipped to the radius, we build a circle in the native spatial reference (26910) using the `ST_Buffer()` function on the click point, then intersect that circle with the parcels.

0 comments on commit 080a901

Please # to comment.