Skip to content

Commit

Permalink
Adding st_make_envelope (#195)
Browse files Browse the repository at this point in the history
* Adding st_make_envelope

* Format

* One more attempt at fixing the formatting...

* Format :|

---------

Co-authored-by: Tyler A. Young <[email protected]>
  • Loading branch information
mjquinlan2000 and s3cur3 authored May 8, 2024
1 parent 260290e commit a8c7816
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions lib/geo_postgis.ex
Original file line number Diff line number Diff line change
Expand Up @@ -432,4 +432,27 @@ defmodule Geo.PostGIS do
defmacro st_make_point(x, y, z, m) do
quote do: fragment("ST_MakePoint(?, ?, ?, ?)", unquote(x), unquote(y), unquote(z), unquote(m))
end

defmacro st_make_envelope(xMin, yMin, xMax, yMax) do
quote do:
fragment(
"ST_MakeEnvelope(?, ?, ?, ?)",
unquote(xMin),
unquote(yMin),
unquote(xMax),
unquote(yMax)
)
end

defmacro st_make_envelope(xMin, yMin, xMax, yMax, srid) do
quote do:
fragment(
"ST_MakeEnvelope(?, ?, ?, ?, ?)",
unquote(xMin),
unquote(yMin),
unquote(xMax),
unquote(yMax),
unquote(srid)
)
end
end

0 comments on commit a8c7816

Please sign in to comment.