[geos-commits] [SCM] GEOS branch main updated. 158c588566e08fd2f31f8c9e7ae069518e8264c5
git at osgeo.org
git at osgeo.org
Tue Dec 23 05:55:52 PST 2025
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".
The branch, main has been updated
via 158c588566e08fd2f31f8c9e7ae069518e8264c5 (commit)
from 72c132a64e678dd1decb73fd5eafac3bd62307ce (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 158c588566e08fd2f31f8c9e7ae069518e8264c5
Author: arriopolis <arjan at cwi.nl>
Date: Tue Dec 23 14:55:23 2025 +0100
Updated the geojson example in the documentation (#1349)
Co-authored-by: arriopolis <arjan_rekenamchine at hotmail.com>
diff --git a/web/content/specifications/geojson.md b/web/content/specifications/geojson.md
index a1b58a4cb..37e26e335 100644
--- a/web/content/specifications/geojson.md
+++ b/web/content/specifications/geojson.md
@@ -52,11 +52,12 @@ The C++ GeoJSON reader does include the option to read full `Feature` and `Featu
#include <geos/io/GeoJSONReader.h>
#include <geos/io/WKTWriter.h>
#include <geos/geom/Geometry.h>
+#include <fstream>
using namespace geos::io;
using namespace geos::geom;
-void main(void)
+int main()
{
// Read file into string
std::ifstream ifs("geojson.json");
@@ -64,7 +65,6 @@ void main(void)
(std::istreambuf_iterator<char>() ));
// Parse GeoJSON string into GeoJSON objects
-
GeoJSONReader reader;
GeoJSONFeatureCollection fc = reader.readFeatures(content);
@@ -74,18 +74,18 @@ void main(void)
writer.setRoundingPrecision(2);
// Print out the features
- for (auto& feature: fc) {
+ for (auto& feature : fc.getFeatures()) {
// Read the geometry
const Geometry* geom = feature.getGeometry();
// Read the properties
- std::map<std::string, GeoJSONValue>& props = feature.getProperties();
+ const std::map<std::string, GeoJSONValue>& props = feature.getProperties();
// Write all properties
std::cout << "----------" << std::endl;
for (const auto& prop : props) {
- std::cout << prop.first << ": " << prop.second << std::endl;
+ std::cout << prop.first << ": " << prop.second.getString() << std::endl;
}
// Write WKT feometry
-----------------------------------------------------------------------
Summary of changes:
web/content/specifications/geojson.md | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list