I am making a geotool application in which I read the data from postgresql database. In this application if i make a buffer on a selected polygon then a buffer is created and buffer layer shown in layer table of JMapFrame. After that i make another buffer on another polygon then there are two layers with same name shown in the layer table in JMapFrame and both the layers shows the buffer on last selected polygon. How can I replace the same name layer with the new one from the layer table in JMapFrame.

My code runs on the click of "Buffer" Button enter image description here

And Result on Jmapfrmae enter image description here

In this JMapFrame all the khasra_buffer layers are the same i.e. the current buffer which is created at Id 80, Thus replacing previously created two buffers.

I want that old khasra_buffer layer should be removed and the only buffer layer that should be shown is of the current buffer on JMapframe.

  • 1
    please add the minimal code needed to show the issue – Ian Turton Sep 25 '16 at 10:01

I would create a single buffer layer in the main program and just change what it displays in your actionListener rather than creating a new layer each time.

| improve this answer | |

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.