Search in sources :

Example 1 with GeoJSONOptions

use of org.discotools.gwt.leaflet.client.layers.others.GeoJSONOptions in project activityinfo by bedatadriven.

the class LeafletReportOverlays method addAdminLayer.

public void addAdminLayer(final AdminOverlay adminOverlay) {
    RequestBuilder request = new RequestBuilder(RequestBuilder.GET, "/resources/adminLevel/" + adminOverlay.getAdminLevelId() + "/entities/features");
    request.setCallback(new RequestCallback() {

        @Override
        public void onResponseReceived(Request request, Response response) {
            try {
                GeoJSONOptions options = new GeoJSONOptions(new AdminChloroplethFeatures(adminOverlay));
                GeoJSON layer = new GeoJSON(response.getText(), options);
                adminLayer.addLayer(layer);
            } catch (Exception e) {
                Log.error("Error adding features to map", e);
            }
        }

        @Override
        public void onError(Request request, Throwable exception) {
            Log.error("Error requesting features", exception);
        }
    });
    try {
        request.send();
    } catch (RequestException e) {
        Log.error("Failed to send request", e);
    }
}
Also used : GeoJSONOptions(org.discotools.gwt.leaflet.client.layers.others.GeoJSONOptions) GeoJSON(org.discotools.gwt.leaflet.client.layers.others.GeoJSON)

Aggregations

GeoJSON (org.discotools.gwt.leaflet.client.layers.others.GeoJSON)1 GeoJSONOptions (org.discotools.gwt.leaflet.client.layers.others.GeoJSONOptions)1