1

I am using openlayers to visualize an industry using image as the layer. On the raster layer I have created an overlay layer.Is it possible to show updated values (dynamic runtime values - as integer) in the overlay layer that gets updated every second? If so please help me how to get this done in openlayers.

1 Answer 1

2

You can do it with features on a vector layer. Provide a datasource that has features on the same coordinates than your features on the raster layer. Then you can access the attributes of these features. For example, population:

myvectorlayer.features[myfeatureindex].attributes.population = 10000;

(or use one of the myvectorlayer.getFeature* functions)

From now on, you can add a label for the features with Openlayers.Style :

var myStyle = new OpenLayers.Style({
  'label' : '${population}',
  'fontSize' : '8px',
  'fontColor' : 'white',
  'labelOutlineColor' : "#000000", 
  'labelOutlineWidth' : 2});

Where ${population} is the attributes name on the vector layers features.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.