Comments (5)
Work in progress :
CREATE OR REPLACE FUNCTION clean_tables() RETURNS void AS $$
DECLARE osm_tables CURSOR FOR
SELECT table_name
FROM information_schema.tables
WHERE table_schema='public'
AND table_type='BASE TABLE'
AND table_name LIKE 'osm_%';
BEGIN
FOR osm_table IN osm_tables LOOP
EXECUTE 'DELETE FROM ' || quote_ident(osm_table.table_name) || ' USING clip WHERE ST_Disjoint(geom,geometry);';
END LOOP;
END;
$$ LANGUAGE plpgsql;
select clean_tables();
Or better with multi rows :
CREATE OR REPLACE FUNCTION clean_tables() RETURNS void AS
$BODY$
DECLARE osm_tables CURSOR FOR
SELECT table_name
FROM information_schema.tables
WHERE table_schema='public'
AND table_type='BASE TABLE'
AND table_name LIKE 'osm_%';
BEGIN
FOR osm_table IN osm_tables LOOP
EXECUTE 'DELETE FROM ' || quote_ident(osm_table.table_name) || ' WHERE osm_id IN (
SELECT DISTINCT osm_id
FROM ' || quote_ident(osm_table.table_name) || '
LEFT JOIN clip ON ST_Intersects(geometry, geom)
WHERE clip.id IS NULL)
;';
END LOOP;
END;
$BODY$
LANGUAGE plpgsql;
select clean_tables();
from docker-osm.
Maybe its not necessary these days but it might be worth checking if vacuuming the db after doing bulk deletes is a good idea.
from docker-osm.
Not useful now as imposm3 natively supports this. You can use a GeoJSON file to limit the geometries on import
from docker-osm.
Do you mean you are going to make the clip shapefile deprecated and add the note about this new geojson file?
from docker-osm.
Hi @Gustry it is already deprecated and we have added it to the description
https://github.com/kartoza/docker-osm#clipping
from docker-osm.
Related Issues (20)
- Rename PBF file HOT 2
- dockerosm_db | 2020-09-29 03:45:02.007 UTC [1613] [unknown]@[unknown] LOG: could not accept SSL connection: tlsv1 alert unknown ca HOT 7
- Exception in importer.py with mknod HOT 5
- Invalid url for geojson file in pbf-downloader HOT 1
- DB only showing South Africa data HOT 1
- no way to set sslmode
- Bitcoin miner in docker hub postgis 13 ? HOT 8
- [RFC] Changes needed for integration tests HOT 2
- No polygon layer in the PG container HOT 1
- cannot import name 'OrderedDict' HOT 1
- db healthcheck: role does not exist
- imposm: TypeError: load() missing 1 required positional argument: 'Loader' HOT 1
- Pin dependencies HOT 2
- Expired key HOT 2
- imposm cannot be built HOT 1
- enrich.py: string indices must be integers HOT 1
- Avoid using subprocess to call psql HOT 1
- docker-osm but using Native Database HOT 5
- TileServer HOT 2
- Does docker-osm support multiples names for an osm object ? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from docker-osm.