View Source Geo.PostGIS (GeoPostGIS v3.7.1)

PostGIS functions that can used in ecto queries PostGIS Function Documentation.

Currently only the OpenGIS functions are implemented.

Examples

defmodule Example do
  import Ecto.Query
  import Geo.PostGIS

  def example_query(geom) do
    from location in Location, limit: 5, select: st_distance(location.geom, ^geom)
  end
end

Summary

Functions

Casts the 2 geometries given to geographies in order to return distance in meters.

Please note that ST_Distance_Sphere has been deprecated as of Postgis 2.2. Postgis 2.1 is no longer supported on PostgreSQL >= 9.5. This macro is still in place to support users of PostgreSQL <= 9.4.x.

Casts the 2 geometries given to geographies in order to check for distance in meters.

Functions

Link to this macro

st_area(geometry)

View Source (macro)
Link to this macro

st_as_binary(geometry)

View Source (macro)
Link to this macro

st_as_text(geometry)

View Source (macro)
Link to this macro

st_bd_m_poly_from_text(wkt, srid)

View Source (macro)
Link to this macro

st_bd_poly_from_text(wkt, srid)

View Source (macro)
Link to this macro

st_boundary(geometry)

View Source (macro)
Link to this macro

st_buffer(geometry, double)

View Source (macro)
Link to this macro

st_buffer(geometry, double, integer)

View Source (macro)
Link to this macro

st_build_area(geometryA)

View Source (macro)
Link to this macro

st_centroid(geometry)

View Source (macro)
Link to this macro

st_collect(geometryList)

View Source (macro)
Link to this macro

st_collect(geometryA, geometryB)

View Source (macro)
Link to this macro

st_contains(geometryA, geometryB)

View Source (macro)
Link to this macro

st_convex_hull(geometry)

View Source (macro)
Link to this macro

st_covered_by(geometryA, geometryB)

View Source (macro)
Link to this macro

st_covers(geometryA, geometryB)

View Source (macro)
Link to this macro

st_crosses(geometryA, geometryB)

View Source (macro)
Link to this macro

st_difference(geometryA, geometryB)

View Source (macro)
Link to this macro

st_dimension(geometry)

View Source (macro)
Link to this macro

st_disjoint(geometryA, geometryB)

View Source (macro)
Link to this macro

st_distance(geometryA, geometryB)

View Source (macro)
Link to this macro

st_distance_in_meters(geometryA, geometryB)

View Source (macro)

Casts the 2 geometries given to geographies in order to return distance in meters.

Link to this macro

st_distance_sphere(geometryA, geometryB)

View Source (macro)

Please note that ST_Distance_Sphere has been deprecated as of Postgis 2.2. Postgis 2.1 is no longer supported on PostgreSQL >= 9.5. This macro is still in place to support users of PostgreSQL <= 9.4.x.

Link to this macro

st_distancesphere(geometryA, geometryB)

View Source (macro)
Link to this macro

st_dwithin(geometryA, geometryB, float)

View Source (macro)
Link to this macro

st_dwithin_in_meters(geometryA, geometryB, float)

View Source (macro)

Casts the 2 geometries given to geographies in order to check for distance in meters.

Link to this macro

st_end_point(geometry)

View Source (macro)
Link to this macro

st_envelope(geometry)

View Source (macro)
Link to this macro

st_equals(geometryA, geometryB)

View Source (macro)
Link to this macro

st_extent(geometry)

View Source (macro)
Link to this macro

st_exterior_ring(geometry)

View Source (macro)
Link to this macro

st_flip_coordinates(geometryA)

View Source (macro)
Link to this macro

st_generate_points(geometryA, npoints)

View Source (macro)
Link to this macro

st_generate_points(geometryA, npoints, seed)

View Source (macro)
Link to this macro

st_geom_coll_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_geom_from_text(text, srid \\ -1)

View Source (macro)
Link to this macro

st_geometry_n(geometry, int)

View Source (macro)
Link to this macro

st_geometry_type(geometry)

View Source (macro)
Link to this macro

st_interior_ring_n(geometry, int)

View Source (macro)
Link to this macro

st_intersection(geometryA, geometryB)

View Source (macro)
Link to this macro

st_intersects(geometryA, geometryB)

View Source (macro)
Link to this macro

st_is_closed(geometry)

View Source (macro)
Link to this macro

st_is_ring(geometry)

View Source (macro)
Link to this macro

st_is_simple(geometry)

View Source (macro)
Link to this macro

st_is_valid(geometry)

View Source (macro)
Link to this macro

st_length(geometry)

View Source (macro)
Link to this macro

st_line_from_text(text, srid \\ -1)

View Source (macro)
Link to this macro

st_line_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_linestring_from_text(text, srid \\ -1)

View Source (macro)
Link to this macro

st_linestring_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_m(geometry)

View Source (macro)
Link to this macro

st_m_geom_coll_from_text(text, srid \\ -1)

View Source (macro)
Link to this macro

st_m_geom_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_m_geometry_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_m_line_from_text(text, srid \\ -1)

View Source (macro)
Link to this macro

st_m_line_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_m_point_from_text(text, srid \\ -1)

View Source (macro)
Link to this macro

st_m_point_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_m_poly_from_text(text, srid \\ -1)

View Source (macro)
Link to this macro

st_m_poly_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_make_box_2d(geometryA, geometryB)

View Source (macro)
Link to this macro

st_make_envelope(xMin, yMin, xMax, yMax)

View Source (macro)
Link to this macro

st_make_envelope(xMin, yMin, xMax, yMax, srid)

View Source (macro)
Link to this macro

st_make_point(x, y)

View Source (macro)
Link to this macro

st_make_point(x, y, z)

View Source (macro)
Link to this macro

st_make_point(x, y, z, m)

View Source (macro)
Link to this macro

st_make_valid(geometry)

View Source (macro)
Link to this macro

st_make_valid(geometry, params)

View Source (macro)
Link to this macro

st_mem_union(geometryList)

View Source (macro)
Link to this macro

st_num_geometries(geometry)

View Source (macro)
Link to this macro

st_num_interior_ring(geometry)

View Source (macro)
Link to this macro

st_num_interior_rings(geometry)

View Source (macro)
Link to this macro

st_num_points(geometry)

View Source (macro)
Link to this macro

st_overlaps(geometryA, geometryB)

View Source (macro)
Link to this macro

st_point(x, y)

View Source (macro)
Link to this macro

st_point_from_text(text, srid \\ -1)

View Source (macro)
Link to this macro

st_point_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_point_n(geometry, int)

View Source (macro)
Link to this macro

st_point_on_surface(geometry)

View Source (macro)
Link to this macro

st_poly_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_polygon_from_text(text, srid \\ -1)

View Source (macro)
Link to this macro

st_polygon_from_wkb(bytea, srid \\ -1)

View Source (macro)
Link to this macro

st_relate(geometryA, geometryB)

View Source (macro)
Link to this macro

st_relate(geometryA, geometryB, intersectionPatternMatrix)

View Source (macro)
Link to this macro

st_set_srid(geometry, srid)

View Source (macro)
Link to this macro

st_shift_longitude(geometry)

View Source (macro)
Link to this macro

st_srid(geometry)

View Source (macro)
Link to this macro

st_start_point(geometry)

View Source (macro)
Link to this macro

st_sym_difference(geometryA, geometryB)

View Source (macro)
Link to this macro

st_touches(geometryA, geometryB)

View Source (macro)
Link to this macro

st_transform(wkt, srid)

View Source (macro)
Link to this macro

st_union(geometryList)

View Source (macro)
Link to this macro

st_union(geometryA, geometryB)

View Source (macro)
Link to this macro

st_within(geometryA, geometryB)

View Source (macro)
Link to this macro

st_x(geometry)

View Source (macro)
Link to this macro

st_y(geometry)

View Source (macro)
Link to this macro

st_z(geometry)

View Source (macro)