Advertisement
Guest User

Untitled

a guest
Nov 19th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. with union_geom as (
  2.     SELECT ST_Union(ST_Multi(the_geom)) as the_geom
  3.       FROM таблица
  4.      WHERE is_deleted is false
  5.        AND branch_id in (select branch_id from таблица where name in ('Санкт-Петербург','Санкт-Петербург Область'))
  6.     ),
  7.     dump_geom as (
  8.         SELECT (ST_Dump(the_geom)).geom as the_geom
  9.           FROM union_geom
  10.     ),
  11.     simple_geom as (
  12.         SELECT ST_Simplify(ST_SetSRID(ST_MakePolygon(ST_ExteriorRing(the_geom)), 4326), 0.0005) as the_geom
  13.           FROM dump_geom
  14.     )
  15.     SELECT  st_astext(ST_Union(ST_Difference(cast(st_buffer(cast(the_geom as geography), 10000) as geometry), the_geom))) as the_geom  FROM simple_geom
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement