Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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