Skip to content

Commit d5a3a51

Browse files
author
beerose
committed
fix example
1 parent 8fee736 commit d5a3a51

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

docs/reference/postgis.rst

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -705,6 +705,44 @@ The following sections document the most commonly used functions:
705705
Create a geometry from its WKT representation.
706706

707707

708+
Example
709+
=======
710+
711+
Here's a simple example showing how to create and query geometric data:
712+
713+
.. code-block:: esdl
714+
715+
# Create a spatial table
716+
type Location {
717+
required name: str;
718+
required position: ext::postgis::geometry;
719+
}
720+
721+
.. code-block:: edgeql
722+
723+
# Insert some data
724+
INSERT Location {
725+
name := 'Central Park',
726+
position := ext::postgis::geomfromtext(
727+
'POLYGON((-73.968285 40.785091, -73.981457 40.768930,
728+
-73.958798 40.764891, -73.968285 40.785091))'
729+
)
730+
};
731+
732+
# Find locations within 5km of a point
733+
SELECT Location {
734+
name,
735+
distance := ext::postgis::distance(
736+
.position,
737+
ext::postgis::makepoint(-73.935242, 40.730610)
738+
)
739+
} FILTER ext::postgis::dwithin(
740+
.position,
741+
ext::postgis::makepoint(-73.935242, 40.730610),
742+
5000 # 5km radius
743+
);
744+
745+
708746
For more information about PostGIS extension, refer to
709747
the `PostGIS documentation <postgis_>`_.
710748

0 commit comments

Comments
 (0)