[OpenLayers-Users] wfs feature geometry based on one attribute value

Mika Lehtonen mika at digikartta.net
Thu Dec 11 02:28:14 EST 2008


Hi Alexandre,

I guess you mean http://dev4.mapgears.com/bdga/bdgaWFS-T.html ?

I have my data in PostGIS and I mean features that aren't shown in my 
map. Or actually they are shown, but through wms. I am already fetching 
some attributes after geometry comparison through wfs GetFeature, but I 
was wondering whether there would some other ways to do that.

There are over 3000 features with polygon geometry, so the method should 
be quite powerful.

- mika -

Alexandre Dube kirjoitti:
> Hey Mika,
>
> Do you mean a feature that is currently shown on the map or any 
> feature from your data source, including the ones currently on screen 
> and the ones not generated yet ?
>
> Because if it's one on screen you could easily accomplish that by 
> looping through your layer.features, searching in your wanted 
> attributes['yourattribute'] value... If you're seeking a feature not 
> yet created, you obviously can't proceed like that.
>
> What type of data do you use ? Shapefiles ? PostGIS ? I suppose it 
> could be possible to use an SQL query to PostGIS to retrieve what you 
> need. ( Really, really not sure... )
>
> But if you use shapefiles and you don't have that many features, you 
> could write a small php script using phpmapscript to echo all your 
> wanted attribute, followed by the bounding box ( or geometry, but bbox 
> is smaller so your script would suffer less from long delay ), put the 
> result of the script in an array and when your user search for an ID, 
> loop through that array. Or you could do a hash with the attribute the 
> user has to input as the key and directly access your array that way.
>
> I did something similar : dev4.mapgears.com/bdga/WFS-T.html look at 
> the list on the upper right. It's a dynamically generated list of 
> cities that changes the map position on change to the selected city.
>
> In firebug, in Console, look at the 3rd query response. You could have 
> something similar.
>
> Best of luck,
>
> Alexandre,
>
> Lehtonen, Mika wrote:
>> Hi,
>>
>> what is the easiest and the less performance consuming method to 
>> retrieve a geometry (actually the bounds would be enough) if I know 
>> an attribute value on that particular feature and I also know that 
>> there is only one feature having that particular attribute value? 
>> Layer is WFS and is already loaded.
>>
>> So what I want is that when the user fills in the attribute field and 
>> submits the form, he/she gets the geometry zoomed to fit. (Actually 
>> that's not so simple, but with that I do my testing.)
>>
>> - mika -
>> _______________________________________________
>> Users mailing list
>> Users at openlayers.org
>> http://openlayers.org/mailman/listinfo/users
>>   
>
>



More information about the Users mailing list