3

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?

  • 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/… – Ian Turton May 26 '11 at 11:52
  • 1
    Thread is gone? Where have all the GeoNerds gone? Why isn't Swing supported? How else does one port GIS visuals to an end-user? – cj5 Jun 18 '15 at 23:51
4

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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