[OpenLayers-Users] Highlighting one shape in a shapefile

Tamlyn Rhodes tamlyn at tamlyn.org
Tue Jul 21 09:26:39 EDT 2009


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.



More information about the Users mailing list