Skip to content

Commit 080a901

Browse files
committed
Use modern syntax of ST_Point
1 parent 170cd3c commit 080a901

File tree

4 files changed

+19
-19
lines changed

4 files changed

+19
-19
lines changed

README.md

+9-9
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,7 @@ BEGIN
501501
args AS (
502502
SELECT
503503
ST_TileEnvelope(z, x, y) AS bounds,
504-
ST_Transform(ST_SetSRID(ST_MakePoint(click_lon, click_lat), 4326), 26910) AS click
504+
ST_Transform(ST_Point(click_lon, click_lat, 4326), 26910) AS click
505505
),
506506
mvtgeom AS (
507507
SELECT
@@ -533,7 +533,7 @@ COMMENT ON FUNCTION public.parcels_in_radius IS 'Given the click point (click_lo
533533
```
534534
Notes:
535535
* The parcels are stored in a table with spatial reference system [3005](https://epsg.io/3005), a planar projection.
536-
* 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.
536+
* 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.
537537
* 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.
538538

539539
#### Dynamic Geometry Example
@@ -617,13 +617,13 @@ cx float8 := 1.5*i*edge;
617617
cy float8 := h*(2*j+abs(i%2));
618618
BEGIN
619619
RETURN ST_MakePolygon(ST_MakeLine(ARRAY[
620-
ST_MakePoint(cx - 1.0*edge, cy + 0),
621-
ST_MakePoint(cx - 0.5*edge, cy + -1*h),
622-
ST_MakePoint(cx + 0.5*edge, cy + -1*h),
623-
ST_MakePoint(cx + 1.0*edge, cy + 0),
624-
ST_MakePoint(cx + 0.5*edge, cy + h),
625-
ST_MakePoint(cx - 0.5*edge, cy + h),
626-
ST_MakePoint(cx - 1.0*edge, cy + 0)
620+
ST_Point(cx - 1.0*edge, cy + 0),
621+
ST_Point(cx - 0.5*edge, cy + -1*h),
622+
ST_Point(cx + 0.5*edge, cy + -1*h),
623+
ST_Point(cx + 1.0*edge, cy + 0),
624+
ST_Point(cx + 0.5*edge, cy + h),
625+
ST_Point(cx - 0.5*edge, cy + h),
626+
ST_Point(cx - 1.0*edge, cy + 0)
627627
]));
628628
END;
629629
$$

examples/openlayers/openlayers-function-click.sql

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ AS $$
1717
WITH hydrants_near AS (
1818
SELECT *
1919
FROM hydrants
20-
ORDER BY geom <-> ST_Transform(ST_SetSRID(ST_MakePoint(lon, lat),4326),26910)
20+
ORDER BY geom <-> ST_Transform(ST_Point(lon, lat, 4326),26910)
2121
LIMIT count
2222
),
2323
-- Convert the tile coordinates to an actual box

hugo/content/usage/function-layers-advanced.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ cx float8 := 1.5*i*edge;
8787
cy float8 := h*(2*j+abs(i%2));
8888
BEGIN
8989
RETURN ST_MakePolygon(ST_MakeLine(ARRAY[
90-
ST_MakePoint(cx - 1.0*edge, cy + 0),
91-
ST_MakePoint(cx - 0.5*edge, cy + -1*h),
92-
ST_MakePoint(cx + 0.5*edge, cy + -1*h),
93-
ST_MakePoint(cx + 1.0*edge, cy + 0),
94-
ST_MakePoint(cx + 0.5*edge, cy + h),
95-
ST_MakePoint(cx - 0.5*edge, cy + h),
96-
ST_MakePoint(cx - 1.0*edge, cy + 0)
90+
ST_Point(cx - 1.0*edge, cy + 0),
91+
ST_Point(cx - 0.5*edge, cy + -1*h),
92+
ST_Point(cx + 0.5*edge, cy + -1*h),
93+
ST_Point(cx + 1.0*edge, cy + 0),
94+
ST_Point(cx + 0.5*edge, cy + h),
95+
ST_Point(cx - 0.5*edge, cy + h),
96+
ST_Point(cx - 1.0*edge, cy + 0)
9797
]));
9898
END;
9999
$$

hugo/content/usage/function-layers.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ AS $$
129129
args AS (
130130
SELECT
131131
ST_TileEnvelope(z, x, y) AS bounds,
132-
ST_Transform(ST_SetSRID(ST_MakePoint(click_lon, click_lat), 4326), 26910) AS click
132+
ST_Transform(ST_Point(click_lon, click_lat, 4326), 26910) AS click
133133
),
134134
mvtgeom AS (
135135
SELECT
@@ -157,5 +157,5 @@ COMMENT ON FUNCTION public.parcels_in_radius IS 'Given the click point (click_lo
157157
Notes:
158158

159159
* The parcels are stored in a table with spatial reference system [3005](https://epsg.io/3005), a planar projection.
160-
* 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.
160+
* 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.
161161
* 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 commit comments

Comments
 (0)