Skip to content

Commit 948e1f5

Browse files
authored
Merge pull request #101 from wesleimp/add-st-generate-points
Support ST_GeneratePoints
2 parents 6550ac3 + 4c1298e commit 948e1f5

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

lib/geo_postgis.ex

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ defmodule Geo.PostGIS do
2424
defmacro st_distance(geometryA, geometryB) do
2525
quote do: fragment("ST_Distance(?,?)", unquote(geometryA), unquote(geometryB))
2626
end
27-
27+
2828
@doc """
2929
Casts the 2 geometries given to geographies in order to return distance in meters
3030
"""
@@ -382,7 +382,21 @@ defmodule Geo.PostGIS do
382382
quote do: fragment("ST_BdMPolyFromText(?, ?)", unquote(wkt), unquote(srid))
383383
end
384384

385-
defmacro st_flip_coordinates(geometryA) do
385+
defmacro st_flip_coordinates(geometryA) do
386386
quote do: fragment("ST_FlipCoordinates(?)", unquote(geometryA))
387387
end
388+
389+
defmacro st_generate_points(geometryA, npoints) do
390+
quote do: fragment("ST_GeneratePoints(?,?)", unquote(geometryA), unquote(npoints))
391+
end
392+
393+
defmacro st_generate_points(geometryA, npoints, seed) do
394+
quote do:
395+
fragment(
396+
"ST_GeneratePoints(?,?,?)",
397+
unquote(geometryA),
398+
unquote(npoints),
399+
unquote(seed)
400+
)
401+
end
388402
end

0 commit comments

Comments
 (0)