On Thursday, September 20, 2012, Gery . wrote: > > Hello, > > I'm testing this very nice example: > http://ian01.geog.psu.edu/geoserver/www/search/gazetteer.html(congratulations > to the author btw) but using in the protocol geojson > (without geojson) instead of the default configuration using WFS and XML > (loaded in geoserver). It works actually nicely, the results appear in > the map and the grid, but the problem is that once I look for one feature, > it just appears the whole geojson in the map, so I understand that the code > (formPanel and name_like) doesn't "fetch" actually the feature I searched > for. I've read somewhere that this problem is either a filter in the > geojson output or the geojson deserialization, but not sure if this is > right. This is basically the part I changed in the original code: > > // define the data source > var protocol = new OpenLayers.Protocol.HTTP({ > url: ' > http://localhost/postgis_geojson.php?geotable=boreholes_point_wgs84&geomfield=geom > ', > format: new OpenLayers.Format.GeoJSON({ > ignoreExtraDims: true, > 'internalProjection': new OpenLayers.Projection("EPSG:900913"), > 'externalProjection': new OpenLayers.Projection("EPSG:4326") > }) > }); > > BTW, I'm using the cool script postgis_geojson.php to get my postgis table > as geojson. > > Any help is appreciated, thanks in advance, >
For name__like to be taken into account (1) your postgis_geojson.php script needs to support comparison filters in the requests, and (2) Protocol.HTTP object needs to have a filterToParams format. By default, if no filterToParams format is passed to the constructor, an Protocol.HTTP instance is configured with QueryStringFilter format, which, for example, converts a LIKE filter on attribute "name" into name__like=%value% in the query string. Hope it helps > -- Eric Lemoine Camptocamp France SAS Savoie Technolac, BP 352 73377 Le Bourget du Lac, Cedex Tel : 00 33 4 79 44 44 96 Mail : [email protected] http://www.camptocamp.com
_______________________________________________ Users mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/openlayers-users
