0

I have a layer (PostGIS table) that I load into JMapFrame. When I zoom to the layers extent I use this:

featureLayer.getBounds();

If I add an object in this layer outside the current exten, it will show when I use "Zoom to layer".

But if I delete the objects on the edge of the layer, I would expect that "Zoom to layer" would zoom in more, but it does not. Not even if I restart my computer and then open the layer in JMapFrame again.

If I make a copy of the geometry and remove the original geometry column in the layer:

query = "ALTER TABLE \"" + layerName + 
"\" ADD COLUMN tmp_geom geometry(\"" + geoType + "\", " + crs +");\r\n" + 
        "UPDATE \"" + layerName + "\" SET tmp_geom = \"" + geocol + "\";\r\n" + 
        "ALTER TABLE \"" + layerName + "\" DROP COLUMN \"" + geocol + "\";\r\n" +
        "ALTER TABLE \"" + layerName + "\" RENAME COLUMN \"tmp_geom\" TO 
        \"" + geocol + "\";";

and try to open it in JMapFrame it will zoom to the "new" and correct extent. But if I close JMapFrame once more and open it again with the layer we are back with the same "old" and wrong extent!

Is it in the cashe somehow and survives a reboot of the computer? How do I update the extent of the layer?

1
  • Geotools is asking PostGiS for the bounds of the layer. PostGIS probably doesn't bother recalculating the bounds very often. Try running vacuum analyse to try to recreate them. Commented Dec 6 at 17:29

0

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.