Skip to content

Commit

Permalink
[GEOS-8750] Improve GeoJSON output format with WFS3 suggested propert…
Browse files Browse the repository at this point in the history
…ies, make the output format extensible
  • Loading branch information
aaime committed May 17, 2018
1 parent 8fa93c4 commit e09c31f
Show file tree
Hide file tree
Showing 10 changed files with 353 additions and 101 deletions.
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -1684,6 +1684,10 @@ private void testJsonRequest(String featureType, String expectResultPath) throws
JSONObject resultJson = (JSONObject) result; JSONObject resultJson = (JSONObject) result;
// check the returned JSON againts the expected result // check the returned JSON againts the expected result
JSONObject expectedJson = readJsonObject(expectResultPath); JSONObject expectedJson = readJsonObject(expectResultPath);

// the timestamp attribute cannot be the same, remove it
resultJson.remove("timeStamp");

assertThat(resultJson, is(expectedJson)); assertThat(resultJson, is(expectedJson));
} }


Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,5 +42,6 @@
} }
], ],
"totalFeatures": "unknown", "totalFeatures": "unknown",
"numberReturned": 5,
"type": "FeatureCollection" "type": "FeatureCollection"
} }
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -453,5 +453,6 @@
} }
], ],
"totalFeatures": "unknown", "totalFeatures": "unknown",
"numberReturned": 4,
"type": "FeatureCollection" "type": "FeatureCollection"
} }
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -646,5 +646,6 @@
} }
], ],
"totalFeatures": "unknown", "totalFeatures": "unknown",
"numberReturned": 7,
"type": "FeatureCollection" "type": "FeatureCollection"
} }
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -753,5 +753,6 @@
} }
], ],
"totalFeatures": "unknown", "totalFeatures": "unknown",
"numberReturned": 4,
"type": "FeatureCollection" "type": "FeatureCollection"
} }
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -60,5 +60,6 @@
} }
], ],
"totalFeatures": "unknown", "totalFeatures": "unknown",
"numberReturned": 3,
"type": "FeatureCollection" "type": "FeatureCollection"
} }
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ protected boolean canHandleInternal(Operation operation) {
/** /**
* Calls through to {@link #write(FeatureCollectionResponse, OutputStream, Operation)}. * Calls through to {@link #write(FeatureCollectionResponse, OutputStream, Operation)}.
*/ */
public final void write(Object value, OutputStream output, Operation operation) public void write(Object value, OutputStream output, Operation operation)
throws IOException, ServiceException { throws IOException, ServiceException {
//for WFS 2.0 we changed the input object type to be the request object adapter, but there //for WFS 2.0 we changed the input object type to be the request object adapter, but there
// is other code (like WMS GetFeatureInfo) that passes in the old objects, so do a check // is other code (like WMS GetFeatureInfo) that passes in the old objects, so do a check
Expand Down
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
/** /**
* GeoJSON writer capable of handling complex features. * GeoJSON writer capable of handling complex features.
*/ */
public final class ComplexGeoJsonWriter { class ComplexGeoJsonWriter {


private final GeoJSONBuilder jsonWriter; private final GeoJSONBuilder jsonWriter;


Expand Down Expand Up @@ -66,7 +66,7 @@ private void encodeFeatureCollection(FeatureIterator iterator) {
/** /**
* Encode a feature in GeoJSON. * Encode a feature in GeoJSON.
*/ */
private void encodeFeature(Feature feature) { protected void encodeFeature(Feature feature) {
// start the feature JSON object // start the feature JSON object
jsonWriter.object(); jsonWriter.object();
jsonWriter.key("type").value("Feature"); jsonWriter.key("type").value("Feature");
Expand Down

0 comments on commit e09c31f

Please sign in to comment.