test/unittests/simplefeaturecollections/points.cpp
//if this test fails, it could just mean the JSON format changed, not that it is invalid/wrong
if this test fails, it could just mean the JSON format changed, not that it is invalid/wrong
if this test fails it could just mean the JSON format changed not that it is invalid / wrong
TEST(PointCollection, toGeoJSONWithMetadata) {
	PointCollection points(SpatioTemporalReference::unreferenced());
	auto &test = points.feature_attributes.addNumericAttribute("test", Unit::unknown());
	points.addCoordinate(1,2);
	points.finishFeature();
	test.set(0, 5.1);
	points.addCoordinate(2,3);
	points.addCoordinate(3,4);
	points.finishFeature();
	test.set(1, 2.1);
	std::string expected = R"({"type":"FeatureCollection","crs":{"type":"name","properties":{"name":"UNREFERENCED:0"}},"features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[1.000000,2.000000]},"properties":{"test":5.100000}},{"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[2.000000,3.000000],[3.000000,4.000000]]},"properties":{"test":2.100000}}]})";
	EXPECT_EQ(expected, points.toGeoJSON(true));
}
TEST ( PointCollection , toGeoJSONWithMetadata ) { PointCollection points ( SpatioTemporalReference :: unreferenced ( ) ) ; auto & test = points . feature_attributes . addNumericAttribute ( " " , Unit :: unknown ( ) ) ; points . addCoordinate ( 1 , 2 ) ; points . finishFeature ( ) ; test . set ( 0 , 5.1 ) ; points . addCoordinate ( 2 , 3 ) ; points . addCoordinate ( 3 , 4 ) ; points . finishFeature ( ) ; test . set ( 1 , 2.1 ) ; std :: string expected = R" ( {"type":"FeatureCollection","crs":{"type":"name","properties":{"name":"UNREFERENCED:0"}},"features":[{"type":"Feature","geometry":{"type":"Point","coordinates":[1.000000,2.000000]},"properties":{"test":5.100000}},{"type":"Feature","geometry":{"type":"MultiPoint","coordinates":[[2.000000,3.000000],[3.000000,4.000000]]},"properties":{"test":2.100000}}]} ) " ; EXPECT_EQ ( expected , points . toGeoJSON ( true ) ) ; }
if this test fails, it could just mean the JSON format changed, not that it is invalid/wrong
if this test fails it could just mean the JSON format changed not that it is invalid / wrong