GeoTux - Soluciones Geoinformáticas Libres - Forum Kunena Site Syndication http://geotux.tuxfamily.org/ Wed, 25 Apr 2018 04:25:40 +0000 Kunena 1.6 http://geotux.tuxfamily.org/components/com_kunena/template/default/images/icons/rss.png GeoTux - Soluciones Geoinformáticas Libres - Forum http://geotux.tuxfamily.org/ en-gb Subject: Construcción de multipunto a partir de puntos en polígono - by: nramire1 http://geotux.tuxfamily.org/index.php/es/forum/8-bases-de-datos-espaciales/1249#1249 http://geotux.tuxfamily.org/index.php/es/forum/8-bases-de-datos-espaciales/1249#1249 Tengo los siguientes datos:

CREATE TABLE arboles (
id SERIAL,
raiz geometry(Point, 22185)
);

INSERT INTO arboles (raiz) VALUES (ST_GeomFromText('POINT(1 1)',22185));
INSERT INTO arboles (raiz) VALUES (ST_GeomFromText('POINT(1 2)',22185));
INSERT INTO arboles (raiz) VALUES (ST_GeomFromText('POINT(5 2)',22185));
INSERT INTO arboles (raiz) VALUES (ST_GeomFromText('POINT(6 2)',22185));
INSERT INTO arboles (raiz) VALUES (ST_GeomFromText('POINT(5 3)',22185));
INSERT INTO arboles (raiz) VALUES (ST_GeomFromText('POINT(1 6)',22185));
INSERT INTO arboles (raiz) VALUES (ST_GeomFromText('POINT(3 6)',22185));


CREATE TABLE patrulla (
id SERIAL,
guardia int,
arboles geometry(MultiPoint, 22185),
region geometry(Polygon, 22185)
);

INSERT INTO patrulla (guardia, region) VALUES (1, ST_GeomFromText('POLYGON((0 0, 0 3, 3 3, 3 0, 0 0))',22185));
INSERT INTO patrulla (guardia, region) VALUES (2, ST_GeomFromText('POLYGON((4 1, 4 4, 8 4, 8 1, 4 1))',22185));
INSERT INTO patrulla (guardia, region) VALUES (3, ST_GeomFromText('POLYGON((2 8, 0 6, 2 4, 2 8))',22185));
INSERT INTO patrulla (guardia, region) VALUES (4, ST_GeomFromText('POLYGON((2 8, 5 6, 2 4, 2 8))',22185));

El objetivo es actualizar el campo arboles de la tabla patrulla, con una geometría multipunto que contenga todos los árboles de la región. Para ello utilizo la siguiente sentencia:

UPDATE patrulla mp
SET arboles = ST_Multi(r.raiz)
FROM arboles r
WHERE ST_Contains(mp.region, r.raiz);

Que no estaría funcionando como yo esperaba, ya que en las regiones que tienen más de un árbol en su interior, sólo toma en cuenta el primero de ellos.
¿Alguno puede darme una idea de por dónde apuntar para buscar la solución?]]>
Bases de datos espaciales Tue, 17 Apr 2018 19:44:28 +0000
Subject: Equivalente en PostGis de simplifiar geometría en Qgis - by: nramire1 http://geotux.tuxfamily.org/index.php/es/forum/8-bases-de-datos-espaciales/1246#1246 http://geotux.tuxfamily.org/index.php/es/forum/8-bases-de-datos-espaciales/1246#1246 Estoy haciendo en una comparativa entre PostGis y Qgis particularmente en la búsqueda de herramientas equivalentes. En este caso buscando el análogo de la herramienta "simplifiar geometrías" (de la caja de herramiantas procesado) de Qgis, en PostGis he encontrado la función ST_RemovePoint la cual sólo remueve un punto a la vez. Algún experimentado se ha puesto a lidiar con esta cuestión y/o podrían orientarme hacia donde seguir.]]> Bases de datos espaciales Tue, 16 Jan 2018 11:28:44 +0000 Subject: Diferencias geométricas entre líneas - by: nramire1 http://geotux.tuxfamily.org/index.php/es/forum/8-bases-de-datos-espaciales/1237#1237 http://geotux.tuxfamily.org/index.php/es/forum/8-bases-de-datos-espaciales/1237#1237 Tengo dos tablas con geometría de líneas la tabla forestal_ln con sus respectivos datos y la tabla mineral_ln con sus datos.
¿Como puedo obtener una tercer tabla con las líneas que se encuentran en la tabla mineral_ln y no están en la tabla forestal_ln?
Abajo dejo los datos con los cuales estoy trabajando.
Saludos


CREATE TABLE forestal_ln(
id serial NOT NULL,
CONSTRAINT forestal_ln_pkey PRIMARY KEY(id)
);
SELECT AddGeometryColumn ( 'forestal_ln', 'geometria', 22185, 'LINESTRING', 2);

INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500230,5500030 6500050)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500290,5500030 6500250)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500050,5500160 6500050)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500050,5500280 6500050)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500090,5500280 6500050)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500090,5500280 6500140)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500150,5500280 6500140)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500150,5500280 6500220)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500190 6500220,5500280 6500220)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500190 6500230,5500100 6500230)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500190 6500220,5500190 6500230)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500100 6500230,5500030 6500230)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500250,5500120 6500250)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500180 6500250,5500120 6500250)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500180 6500250,5500280 6500250)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500250,5500280 6500270)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500290,5500280 6500270)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500290,5500090 6500290)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500290,5500090 6500290)',22185));

INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500090 6500290,5500180 6500270)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500180 6500270,5500220 6500270)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500220 6500270,5500120 6500250)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500220 6500270,5500280 6500270)',22185));

INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500100 6500230,5500100 6500170)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500100 6500170,5500030 6500050)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500100 6500170,5500160 6500170)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500170,5500160 6500150)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500150,5500160 6500140)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500140,5500280 6500140)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500140,5500160 6500090)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500090,5500280 6500090)',22185));
INSERT INTO forestal_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500090,5500160 6500050)',22185));

CREATE TABLE mineral_ln(
id serial NOT NULL,
CONSTRAINT mineral_ln_pkey PRIMARY KEY(id)
);
SELECT AddGeometryColumn ( 'mineral_ln', 'geometria', 22185, 'LINESTRING', 2);

INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500230,5500030 6500050)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500050,5500160 6500050)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500050,5500280 6500050)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500290,5500030 6500250)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500090,5500280 6500050)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500090,5500280 6500140)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500150,5500280 6500140)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500150,5500280 6500220)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500190 6500220,5500280 6500220)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500190 6500230,5500100 6500230)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500190 6500220,5500190 6500230)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500100 6500230,5500030 6500230)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500250,5500120 6500250)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500180 6500250,5500120 6500250)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500180 6500250,5500280 6500250)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500250,5500280 6500270)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500290,5500280 6500270)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500280 6500290,5500090 6500290)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500030 6500290,5500090 6500290)',22185));

INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500180 6500250,5500180 6500270)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500180 6500270,5500220 6500270)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500220 6500270,5500280 6500270)',22185));

INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500100 6500230,5500100 6500170)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500100 6500170,5500160 6500170)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500170,5500190 6500170)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500170,5500160 6500150)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500190 6500170,5500190 6500220)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500150,5500160 6500140)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500140,5500280 6500140)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500140,5500160 6500090)',22185));
INSERT INTO mineral_ln (geometria) VALUES(ST_GeomFromText('LINESTRING(5500160 6500090,5500160 6500050)',22185));]]>
Bases de datos espaciales Tue, 11 Jul 2017 15:08:03 +0000