Skip to content

Commit

Permalink
Merge pull request #333 from gisaia/feature/fix-#103
Browse files Browse the repository at this point in the history
Remove duplicate geo in geojson
  • Loading branch information
mbarbet committed Sep 28, 2018
2 parents 03246ab + 0808e5b commit 552e920
Showing 1 changed file with 8 additions and 5 deletions.
Expand Up @@ -45,10 +45,7 @@
import javax.ws.rs.*;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.ExecutionException;

public class GeoSearchRESTService extends ExploreRESTServices {
Expand Down Expand Up @@ -497,7 +494,13 @@ protected FeatureCollection getFeatures(CollectionReference collectionReference,
} else if (centroidGeoJson != null) {
feature.setGeometry(centroidGeoJson);
}
feature.setProperties(flat?MapExplorer.flat(hit.getSourceAsMap(),new MapExplorer.ReduceArrayOnKey("_"), exclude):hit.getSourceAsMap());
exclude.stream().forEach(e->{
String pathToRemove = e.substring(0,e.lastIndexOf("."));
String keyToRemove = e.substring(e.lastIndexOf(".")+1);
Map objectToRemove = (Map) MapExplorer.getObjectFromPath(pathToRemove, source);
objectToRemove.remove(keyToRemove);
});
feature.setProperties(flat?MapExplorer.flat(source,new MapExplorer.ReduceArrayOnKey("_"), exclude):source);
feature.setProperty(FEATURE_TYPE_KEY, FEATURE_TYPE_VALUE);
fc.add(feature);
}
Expand Down

0 comments on commit 552e920

Please sign in to comment.