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 need to change the features of a MapLayer in real-time but I don't know how I can update/refresh/repaint the layer on the map without having to remove it and add it again (which creates flickering).

map.removeLayer(pathML);
SimpleFeatureCollection pointsFC = createFeatureCollection(points);
pathML = new MapLayer(pointsFC, pathStyle);
map.addLayer(pathML);

Do you know a better way to update the Layer rendering?

Thanks in advance. André.

share|improve this question
    
Any GeoTools nerds out there? –  jvangeld May 25 '11 at 22:27
    
most of the GeoTools' nerds already answered this question on the mailing list :-) osgeo-org.1803224.n2.nabble.com/… –  iant May 26 '11 at 11:52

1 Answer 1

This actually makes the geotools faq page for gt-swing. The real answer is to use JMapPane as an example (because that is what it is) and build your own widget using a number of layers for a fast response.

You may also find the spatial indexed back feature collections useful in providing a fast experience if you don't mind holding your data in memory.

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.