2

Trying to use CQL bounding-box filter, but get a strange result like this:

loadFeatures({"type":"FeatureCollection","totalFeatures":15640,"features":[]})

It showing a total 15640 features in that bbox, but why there are no list of them and "features" are just empty list?

This is my CQL filter:

http://loom-gis.geo.ut.ee:8080/geoserver/ermas/ows?service=WFS&version=1.1.0&request=GetFeature&typeName=ermas:testdata_geopnt&outputFormat=text/javascript&format_options=callback:loadFeatures&maxFeatures=50&srsname=EPSG:3301&EPSG:3301&CQL_FILTER=%28BBOX%28geometry,494981.10875,%206437855.3625,%20684824.8587499999,%206569105.3625%29%29
2

you have to declare that you use EPSG 3301 and not EPSG 4326 for the BBOX with wfs in version 1.1.1.: " If the crsuri is not specified then the 2-D coordinates shall be specified using decimal degrees and WGS84" ( http://augusttown.blogspot.de/2010/08/mysterious-bbox-parameter-in-web.html )

Just add a crsuri at the end:

http://loom-gis.geo.ut.ee:8080/geoserver/ermas/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ermas:testdata_geopnt&outputFormat=text/javascript&format_options=callback:loadFeatures&maxFeatures=50&srsname=EPSG:3301&BBOX=494981.10875, 6437855.3625, 684824.8587499999, 6569105.3625,EPSG:3301

with version 1.0.0 it works, too:

$.ajax("http://loom-gis.geo.ut.ee:8080/geoserver/ermas/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=ermas:testdata_geopnt&outputFormat=text/javascript&format_options=callback:loadFeatures&maxFeatures=50&srsname=EPSG:3301&CQL_FILTER=%28BBOX%28geometry,494981.10875,%206437855.3625,%20684824.8587499999,%206569105.3625%29%29",
    { dataType: "jsonp" }
).done(function ( data ) {
    console.log('done will never be called, unfortunately...');

});

function loadFeatures(data) {
    var map=new OpenLayers.Map("map");
    map.addLayer(new OpenLayers.Layer.OSM());
    console.log("jetzt");
    var vector = new OpenLayers.Layer.Vector({
    });

  var geojsonParser = new OpenLayers.Format.GeoJSON(
  {
  'internalProjection': new OpenLayers.Projection("EPSG:900913"),
                    'externalProjection': new OpenLayers.Projection("EPSG:3301")
  });
  vector.addFeatures(geojsonParser.read(data));
     map.addLayer(vector);
    map.zoomToExtent(vector.getDataExtent());
    console.log(data);

};

see http://jsfiddle.net/expedio/nxd1t2t3/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.