[OpenLayers-Users] Highlighting one shape in a shapefile

Andreas Hocevar ahocevar at opengeo.org
Tue Jul 21 10:06:05 EDT 2009


Hi,

you could use WMS to display your contry layer, and use the GetFeature
control to issue a WFS GetFeature request for the country to
highlight. See http://www.openlayers.org/dev/examples/getfeature-wfs.html
for an example.

Regards,
Andreas.

On Tue, Jul 21, 2009 at 3:26 PM, Tamlyn Rhodes<tamlyn at tamlyn.org> wrote:
> Sorry for this broad question but I'm not sure how to go about this.
>
> I have a shapefile of countries displayed in openlayers. Each country
> has a (vector) label. Clicking on the country label should 'highlight'
> the country.
>
> I've got this working for a few countries by creating a layer per
> country and setting its fill to transparent and all other countries to
> a translucent black, hence effectively dimming the rest of the world.
> The problem is when I then create a layer for every country (246 in
> total) the mapserver falls over with no visible errors and nothing in
> the server logs. It also seems somehow wrong to have 250 layers even
> if only 3 of them will be visible at a time.
>
> Is it possible to specify a CLASS EXPRESSION dynamically in the
> mapserver URL? If so that would mean I can create a single layer and
> choose which shape to turn on or off directly from openlayers.
>
> I don't think it's appropriate to use a vector layer to do the
> highlighting because the KML of countries is about 1.5MB and I imagine
> it would be pretty slow to render.
>
> Any suggestions?
>
>  T.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



-- 
Andreas Hocevar
OpenGeo - http://opengeo.org/
Expert service straight from the developers.



More information about the Users mailing list