[OpenLayers-Users] GeoJSON filter function

Adrián Ribao Martínez aribao at gmail.com
Fri Sep 11 09:41:05 EDT 2009


Hello,

you are right, my mail wasn't clear. Whant  I wanted to do is change the icon of the feature in function of an attribute. I thought that the filter funcion would help me to do that but then I discovered this solution:

var style = new OpenLayers.Style({
     'pointRadius': 10,
     'externalGraphic': '${icon}'
     });

which is much better.

Anyway, I like to know how could I use the filter funcion of the GeoJSON.read method.

http://dev.openlayers.org/releases/OpenLayers-2.8/doc/apidocs/files/OpenLayers/Format/GeoJSON-js.html#OpenLayers.Format.GeoJSON.read

" This can be used to reform generic objects into instances of classes, or to transform date strings into Date objects."

I have been testing the filter argument passing a function, but I don't know the arguments and it didn't work. I'd like to know how could I transfrom date strings for example.

This won't work:
geojson_format.read(data, "FeatureCollection", function(e){alert(e); return e;})


Thank you.

On Viernes, 11 de Septiembre de 2009 15:13:23 Christopher Schmidt escribió:
> On Fri, Sep 11, 2009 at 10:36:32AM +0200, Adrian Ribao wrote:
> > Hello,
> > 
> > I'm trying to use GeoJSON Format but I can't make the filter function work.
> > Could someone give me an example please?
> 
> You're trying to describe how you're trying to do something, instead of
> what you're trying to do. I recommend sharing what you're trying to do;
> it will likely allow people to better assist you.
> 
> Best Regards,
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
Url : http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090911/7271f525/attachment.bin


More information about the Users mailing list