]> granicus.if.org Git - postgis/commitdiff
Change GeoJSON example to be self-contained
authorPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 1 May 2019 16:59:08 +0000 (16:59 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Wed, 1 May 2019 16:59:08 +0000 (16:59 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@17419 b70326c6-7e19-0410-871a-916f4a2858ee

doc/reference_output.xml

index 7cea2f22a71b7f4be4c3f80b85cdf3a3e6109f63..84cb057a73eea46f3768535681447a9abcae4da1 100644 (file)
@@ -398,14 +398,18 @@ CIRCULARSTRING(220268 150415 1,220227 150505 2,220227 150406 3)
                <para>You can test and view your GeoJSON data online on <ulink url="http://geojson.io/">geojson.io</ulink>.</para>
 
                <para>ST_AsGeoJSON only builds geometry. You need to build the rest of Feature from your Postgres table yourself:</para>
-               <programlisting>
-SELECT planet_osm_point.*
-FROM planet_osm_point
-LIMIT 10;
-                                          st_asgeojson
------------------------------------------------------------------------------------------------------------
-{"type":"FeatureCollection","features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[23.569251,51.541599]},"properties":{"osm_id":3424148658,"place":"locality"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[23.625174,51.511718]},"properties":{"osm_id":4322036818,"place":"locality"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[23.613928,51.5417]},"properties":{"osm_id":242979330,"place":"hamlet"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[23.586361,51.563272]},"properties":{"osm_id":3424148656,"place":"locality"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[23.605488,51.553886]},"properties":{"osm_id":242979323,"place":"village"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[23.6067,51.57609]},"properties":{"osm_id":242979327,"place":"village"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[23.636533,51.575683]},"properties":{"osm_id":5737800420,"place":"locality"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[23.656733,51.518733]},"properties":{"osm_id":5737802397,"place":"locality"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[23.672542,51.504584]},"properties":{"osm_id":242979320,"place":"hamlet"}},{"type":"Feature","geometry":{"type":"Point","coordinates":[23.574094,51.63389]},"properties":{"osm_id":242979333,"place":"village"}}]}
-               </programlisting>
+               <programlisting>SELECT ST_AsGeoJSON(t.*)
+FROM (VALUES
+  (1, 'one', 'POINT(1 1)'::geometry),
+  (2, 'two', 'POINT(2 2)'),
+  (3, 'three', 'POINT(3 3)'))
+AS t(id, name, geom);
+
+                                                  st_asgeojson
+-----------------------------------------------------------------------------------------------------------------
+ {"type": "Feature", "geometry": {"type":"Point","coordinates":[1,1]}, "properties": {"id": 1, "name": "one"}}
+ {"type": "Feature", "geometry": {"type":"Point","coordinates":[2,2]}, "properties": {"id": 2, "name": "two"}}
+ {"type": "Feature", "geometry": {"type":"Point","coordinates":[3,3]}, "properties": {"id": 3, "name": "three"}}</programlisting>
 
                <programlisting>SELECT ST_AsGeoJSON(geom) from fe_edges limit 1;
                                           st_asgeojson