I have recently setup Geoserver, and am now working on returning GeoJSON (as JSONP) within a Leaflet application. This works fine if I do not specify the propertyName parameter, but if I attempt to restrict the attributes that get returned by using this parameter, the returned GeoJSON is no longer valid. The geometry property is null, but there are still lon and lat properties returned.
rootUrl = "http://localhost:8080/geoserver/ows";defaultParameters = { service: 'WFS', version: '2.0.0', request: 'GetFeature', typeName: 'Store:layer', maxFeatures: 200, count: 2000, outputFormat: 'text/javascript', format_options: 'callback:handleJson', srsname: 'EPSG:4326', sortby: 'observation_time_milli'};parameters = L.Util.extend(defaultParameters);$.ajax({ url: rootUrl + L.Util.getParamString(parameters), dataType: 'jsonp', jsonpCallback: 'handleJson', success: handleJson});This returns valid GeoJSON, with more parameters than I care to serve:
{"type":"Feature","id":"layer.fid-c2b3b52_1518a211ba4_-5166","geometry":{"type":"Point","coordinates":[162.794,-46.7882]},"geometry_name":"geom","properties":{"uid":1,"amplitude":22.4,"direction":2,"gdop":null,"ellipse_bearing":67,"ellipse_major_axis":10.2,"ellipse_minor_axis":0.8,"lon":162.794,"lat":-46.7882,"observation_time":"2015-08-01T11:10:12Z","observation_time_milli":1438427411670,"nanoseconds_remainder":926104,"query_time":"2015-08-30T22:41:31Z","insert_time":"2015-08-30T22:44:59Z","api_id":2,"sensor_chi_squared":0.5,"sensor_n_reporting":5,"sensor_degrees_freedom":6,"sensor_range_normalised_signal":121.2,"sensor_information_used_angle":true,"sensor_information_used_signal":false,"sensor_information_used_time":true,"sensor_rise_time":6.1,"sensor_peak_time":26}}Yet if I try to subset the features by adding the propertyName parameter to the default parameters (discussed in the Geoserver getFeature documentation):
... srsname: 'EPSG:4326', sortby: 'observation_time_milli', propertyName: 'ellipse_major_axis,ellipse_bearing,ellipse_minor_axis,amplitude'};...I receive less information, but a null geometry:
{"type":"Feature","id":"layer.fid-c2b3b52_1518a211ba4_-68d6","geometry":null,"properties":{"uid":1,"ellipse_major_axis":10.2,"lon":162.794,"lat":-46.7882,"observation_time_milli":1438427411670,"api_id":2}}Is this a bug?
أكثر...
rootUrl = "http://localhost:8080/geoserver/ows";defaultParameters = { service: 'WFS', version: '2.0.0', request: 'GetFeature', typeName: 'Store:layer', maxFeatures: 200, count: 2000, outputFormat: 'text/javascript', format_options: 'callback:handleJson', srsname: 'EPSG:4326', sortby: 'observation_time_milli'};parameters = L.Util.extend(defaultParameters);$.ajax({ url: rootUrl + L.Util.getParamString(parameters), dataType: 'jsonp', jsonpCallback: 'handleJson', success: handleJson});This returns valid GeoJSON, with more parameters than I care to serve:
{"type":"Feature","id":"layer.fid-c2b3b52_1518a211ba4_-5166","geometry":{"type":"Point","coordinates":[162.794,-46.7882]},"geometry_name":"geom","properties":{"uid":1,"amplitude":22.4,"direction":2,"gdop":null,"ellipse_bearing":67,"ellipse_major_axis":10.2,"ellipse_minor_axis":0.8,"lon":162.794,"lat":-46.7882,"observation_time":"2015-08-01T11:10:12Z","observation_time_milli":1438427411670,"nanoseconds_remainder":926104,"query_time":"2015-08-30T22:41:31Z","insert_time":"2015-08-30T22:44:59Z","api_id":2,"sensor_chi_squared":0.5,"sensor_n_reporting":5,"sensor_degrees_freedom":6,"sensor_range_normalised_signal":121.2,"sensor_information_used_angle":true,"sensor_information_used_signal":false,"sensor_information_used_time":true,"sensor_rise_time":6.1,"sensor_peak_time":26}}Yet if I try to subset the features by adding the propertyName parameter to the default parameters (discussed in the Geoserver getFeature documentation):
... srsname: 'EPSG:4326', sortby: 'observation_time_milli', propertyName: 'ellipse_major_axis,ellipse_bearing,ellipse_minor_axis,amplitude'};...I receive less information, but a null geometry:
{"type":"Feature","id":"layer.fid-c2b3b52_1518a211ba4_-68d6","geometry":null,"properties":{"uid":1,"ellipse_major_axis":10.2,"lon":162.794,"lat":-46.7882,"observation_time_milli":1438427411670,"api_id":2}}Is this a bug?
أكثر...