I have OSM data of the whole world in a PostGIS db. For some reasons, I want to work with tables which have only data from a given bounding box inside.
I create this tables with following command:
CREATE TABLE export.osm_adminareas_a AS SELECT * FROM public.osm_adminareas_a WHERE geom && ST_MakeEnvelope(12,47,13,48, 4326)
But only when doing this with point geometry, the result is what I expect, e.g. only the points inside the bounding box. When doing this with lines or polygon, I will get data not only outside the box, but also from regions which were absolutely far away from my box.
(For example my box is in the border region of Austria and Germany and I will get admin borders from France, and even Russia or the USA,....)
What are your recommendations for clipping polygon and line geometry exactly at the borders of my bounding box?