Versiones no soportadas:2.6 2.5 2.4 2.3 2.2 2.1 2.0
pgr_analyzeGraph
– Obsoleto desde 3.8.0¶
pgr_analyzeGraph
— analiza la topología de red.
Disponibilidad
Versión 3.8.0
Función obsoleta.
Versión 2.0.0
Función oficial.
Migración de pgr_analyzeGraph
¶
Comenzando en v3.8.0
Antes de la Depreciación: Se calculó lo siguiente:
Número de segmentos aislados.
Cantidad de callejones sin salida.
Número de huecos potenciales encontrados cerca de callejones sin salida.
Número de intersecciones. (entre 2 aristas)
Donde
- Componente de grafo:
Un sub-grafo conectando no es parte de un grafo conectado mas grande.
- Segmento aislado:
Un componente de grafo con un solo segmento.
- Callejones sin salida:
Un vértice que participa en una sola arista.
- Espacios:
Espacio entre dos geometrías.
- Intersección:
Es una relación topológica entre dos geometrías.
Migración.
Componentes.
En lugar de contar sólo segmentos aislados, determinar todos los componentes del grafo.
Dependiendo de los requisitos de la aplicación final utilizar:
Por ejemplo:
SELECT *
FROM pgr_connectedComponents(
'SELECT id, source, target, cost, reverse_cost FROM edges'
);
seq | component | node
-----+-----------+------
1 | 1 | 1
2 | 1 | 3
3 | 1 | 5
4 | 1 | 6
5 | 1 | 7
6 | 1 | 8
7 | 1 | 9
8 | 1 | 10
9 | 1 | 11
10 | 1 | 12
11 | 1 | 15
12 | 1 | 16
13 | 1 | 17
14 | 2 | 2
15 | 2 | 4
16 | 13 | 13
17 | 13 | 14
(17 rows)
Callejones sin salida.
En lugar de contar los callejones sin salida, determine todos los callejones sin salida del grafo utilizando pgr_degree.
Por ejemplo:
SELECT *
FROM pgr_degree($$SELECT id, source, target FROM edges$$)
WHERE degree = 1;
node | degree
------+--------
9 | 1
5 | 1
4 | 1
14 | 1
13 | 1
2 | 1
1 | 1
(7 rows)
Potential gaps near dead ends.
Instead of counting potential gaps between geometries, determine the geometric gaps in the graph using pgr_findCloseEdges.
Por ejemplo:
WITH
deadends AS (
SELECT id,geom, (in_edges || out_edges)[1] as inhere
FROM vertices where array_length(in_edges || out_edges, 1) = 1),
results AS (
SELECT (pgr_findCloseEdges('SELECT id, geom FROM edges WHERE id != ' || inhere , geom, 0.001)).*
FROM deadends)
SELECT d.id, edge_id, distance, st_AsText(geom) AS point, st_asText(edge) edge
FROM results JOIN deadends d USING (geom);
id | edge_id | distance | point | edge
----+---------+-------------------+---------------------------+--------------------------------------
4 | 14 | 1.00008890058e-12 | POINT(1.999999999999 3.5) | LINESTRING(1.999999999999 3.5,2 3.5)
(1 row)
Relaciones topológicas.
Instead of counting intersections, determine topological relationships between geometries.
Se pueden utilizar varias funciones de PostGIS: ST_Intersects, ST_Crosses, ST_Overlaps, etc.
Por ejemplo:
SELECT e1.id AS id1, e2.id AS id2
FROM edges e1, edges e2 WHERE e1 < e2 AND st_crosses(e1.geom, e2.geom);
id1 | id2
-----+-----
13 | 18
(1 row)
Descripción¶
La función devuelve:
OK
Cuando el análisis ha terminado.FAIL
cuando el análisis no se completó debido a un error.
[the_geom, id, source, target, rows_where]
VARCHAR
Pre-requisitos
La tabla de aristas a analizar debe contener una columna origen y una columna destino rellenas con identificadores de los vértices de los segmentos y la correspondiente tabla de vértices <edge_table>_vertices_pgr que almacena la información de los vértices.
Parámetros¶
La función de análisis gráfico acepta los siguientes parámetros:
- edge_table:
text
La tabla de la red. (puede contener el nombre del esquema)- tolerancia:
float8
ajuste tolerancia de bordes desconectados. (en la unidad de proyección)- the_geom:
text
nombre de la columna de la geometría en la tabla de la red. El valor por defecto es the_geom`.- id:
text``Nombre de la columna de la clave principal de la tabla de red. Valor por defecto es ``id
”.- source:
id``Nombre de columna de origen de la tabla de red. El valor predeterminado es``source
.- target:
text
El nombre de la columna del destino del segmento. El valor por defecto estarget
.- rows_where:
text
Condición para seleccionar un subconjunto o filas. Valor predeterminado estrue
para indicar todas las filas.
La función devuelve:
OK
Cuando el análisis ha terminado.Utiliza la tabla de los vértices: <edge_table>_vertices_pgr.
Llena totalmente las columnas
cnt
ychk
de la tabla de vértices.Devuelve el análisis de la sección de la red definida por
rows_where
FAIL
cuando el análisis no se completó debido a un error.No se encuentra en la tabla de los vértices.
Una columna de la tabla de red requerida no se encuentra o no es del tipo apropiado.
La condición no está bien formada.
Los nombres de origen, destino o id son las mismos.
No pudo determinarse el SRID de la geometría.
La tabla de vértices
La estructura de la tabla de los vértices es:
- id:
bigint
identificador del vértice.- cnt:
integer
Número de vértices en edge_table que hacen referencia a este vértice.- chk:
integer
Indicador de que el vértice puede tener un problema.- ein:
integer
número de vértices en la edge_table que hacen referencia a este vértice como entrante.- eout:
integer
número de vértices en la edge_table que hacen referencia a este vértice como saliente.- the_geom:
geometry
Valor de la geometría POINT del vértice.
Uso cuando las columnas de la tabla de borde coinciden con los valores por defecto:¶
La forma más sencilla de usar pgr_analyzeGraph es:
SELECT id, geom AS the_geom, 0 AS cnt, 0 AS chk INTO edges_vertices_pgr FROM vertices;
SELECT 17
SELECT pgr_analyzeGraph('edges',0.001,'geom');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Los argumentos se escriben en el orden descrito en los parámetros:
SELECT pgr_analyzeGraph('edges',0.001,'geom','id','source','target');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Obtenemos el mismo resultado que la forma más sencilla de utilizar la función.
Advertencia
Un error puede ocurrir cuando
los argumentos se no se escriben en el orden apropiado:
En este ejemplo, la columna id
de la tabla mytable
se pasa a la función como geometría, y la columna de geometría the_geom
se pasa a la función de columna id
.
SELECT pgr_analyzeGraph('edges',0.001,'id','geom','source','target');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'id','geom','source','target','true')
NOTICE: Performing checks, please wait ...
NOTICE: Got function st_srid(bigint) does not exist
NOTICE: ERROR: something went wrong when checking for SRID of id in table public.edges
pgr_analyzegraph
------------------
FAIL
(1 row)
Cuando se utiliza la notación por nombre
No importa el orden de los parámetros:
SELECT pgr_analyzeGraph('edges',0.001,the_geom:='geom',id:='id',source:='source',target:='target');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
SELECT pgr_analyzeGraph('edges',0.001,source:='source',id:='id',target:='target',the_geom:='geom');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Parámetros definidos con un valor predeterminado se pueden omitir, siempre y cuando el valor coincida con el valor por defecto:
SELECT pgr_analyzeGraph('edges',0.001, 'geom', source:='source');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Seleccionar filas utilizando el parámetro rows_where
La selección de filas basadas en el id. El análisis muestra una parte de la red.
SELECT pgr_analyzeGraph('edges',0.001, 'geom', rows_where:='id < 10');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','id < 10')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 0
NOTICE: Dead ends: 4
NOTICE: Potential gaps found near dead ends: 0
NOTICE: Intersections detected: 0
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Seleccionar las filas donde la geometría está cerca de la geometría de la fila con id
= 5
SELECT pgr_analyzeGraph('edges',0.001, 'geom', rows_where:='geom && (SELECT st_buffer(geom,0.05) FROM edge_table WHERE id=5)');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','geom && (SELECT st_buffer(geom,0.05) FROM edge_table WHERE id=5)')
NOTICE: Performing checks, please wait ...
NOTICE: Got relation "edge_table" does not exist
NOTICE: ERROR: Condition is not correct. Please execute the following query to test your condition
NOTICE: select count(*) from public.edges WHERE true AND (geom && (SELECT st_buffer(geom,0.05) FROM edge_table WHERE id=5))
pgr_analyzegraph
------------------
FAIL
(1 row)
Seleccionar las filas donde la geometría está cerca de la geometría de la fila con``gid`` =100 de la tabla othertable
.
CREATE TABLE otherTable AS (SELECT 100 AS gid, st_point(2.5,2.5) AS other_geom) ;
SELECT 1
SELECT pgr_analyzeGraph('edges',0.001, 'geom', rows_where:='geom && (SELECT st_buffer(geom,1) FROM otherTable WHERE gid=100)');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','geom && (SELECT st_buffer(geom,1) FROM otherTable WHERE gid=100)')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Uso cuando las columnas de la tabla de borde NO COINCIDEN con los valores por defecto:¶
Para la siguiente tabla
CREATE TABLE mytable AS (SELECT id AS gid, source AS src ,target AS tgt , geom AS mygeom FROM edges);
SELECT 18
SELECT id, geom AS the_geom, 0 AS cnt, 0 AS chk INTO mytable_vertices_pgr FROM vertices;
SELECT 17
Usando notación posicional:
Las discusiones deben recibir en el orden descrito en los parámetros:
SELECT pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Advertencia
Un error puede ocurrir cuando los argumentos no se dan en el orden adecuado: en este ejemplo, la columna gid
de la tabla mytable
se pasa a la función como geometría, y la columna de geometría``mygeom`` se pasa a la función como columna id
.
SELECT pgr_analyzeGraph('mytable',0.0001,'gid','mygeom','src','tgt');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.0001,'gid','mygeom','src','tgt','true')
NOTICE: Performing checks, please wait ...
NOTICE: Got function st_srid(bigint) does not exist
NOTICE: ERROR: something went wrong when checking for SRID of gid in table public.mytable
pgr_analyzegraph
------------------
FAIL
(1 row)
Cuando se utiliza la notación por nombre
No importa el orden de los parámetros:
SELECT pgr_analyzeGraph('mytable',0.001,the_geom:='mygeom',id:='gid',source:='src',target:='tgt');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
SELECT pgr_analyzeGraph('mytable',0.001,source:='src',id:='gid',target:='tgt',the_geom:='mygeom');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
En este escenario omitir un parámetro crearía un error porque los valores predeterminados de los nombres de columna no coinciden con los nombres de columna de la tabla.
Seleccionar filas utilizando el parámetro rows_where
La selección de filas basadas en el id.
SELECT pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt',rows_where:='gid < 10');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt','gid < 10')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 0
NOTICE: Dead ends: 4
NOTICE: Potential gaps found near dead ends: 0
NOTICE: Intersections detected: 0
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
SELECT pgr_analyzeGraph('mytable',0.001,source:='src',id:='gid',target:='tgt',the_geom:='mygeom',rows_where:='gid < 10');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt','gid < 10')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 0
NOTICE: Dead ends: 4
NOTICE: Potential gaps found near dead ends: 0
NOTICE: Intersections detected: 0
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Seleccionar las filas donde la geometría está cerca de la geometría de la fila con id
=5 .
SELECT pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt',
rows_where:='mygeom && (SELECT st_buffer(mygeom,1) FROM mytable WHERE gid=5)');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt','mygeom && (SELECT st_buffer(mygeom,1) FROM mytable WHERE gid=5)')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 1
NOTICE: Dead ends: 5
NOTICE: Potential gaps found near dead ends: 0
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
SELECT pgr_analyzeGraph('mytable',0.001,source:='src',id:='gid',target:='tgt',the_geom:='mygeom',
rows_where:='mygeom && (SELECT st_buffer(mygeom,1) FROM mytable WHERE gid=5)');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt','mygeom && (SELECT st_buffer(mygeom,1) FROM mytable WHERE gid=5)')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 1
NOTICE: Dead ends: 5
NOTICE: Potential gaps found near dead ends: 0
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Seleccionar las filas donde la geometría está cerca de la place=”myhouse” de la tabla othertable
. (Nótese el uso de quote_literal)
DROP TABLE IF EXISTS otherTable;
DROP TABLE
CREATE TABLE otherTable AS (SELECT 'myhouse'::text AS place, st_point(2.5,2.5) AS other_geom) ;
SELECT 1
SELECT pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt',
rows_where:='mygeom && (SELECT st_buffer(other_geom,1) FROM otherTable WHERE place='||quote_literal('myhouse')||')');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt','mygeom && (SELECT st_buffer(other_geom,1) FROM otherTable WHERE place='myhouse')')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 10
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
SELECT pgr_analyzeGraph('mytable',0.001,source:='src',id:='gid',target:='tgt',the_geom:='mygeom',
rows_where:='mygeom && (SELECT st_buffer(other_geom,1) FROM otherTable WHERE place='||quote_literal('myhouse')||')');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('mytable',0.001,'mygeom','gid','src','tgt','mygeom && (SELECT st_buffer(other_geom,1) FROM otherTable WHERE place='myhouse')')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 10
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Ejemplos Adicionales¶
UPDATE edges_vertices_pgr SET (cnt,chk) = (0,0);
UPDATE 17
SELECT pgr_analyzeGraph('edges', 0.001, 'geom');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 7
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
SELECT pgr_analyzeGraph('edges',0.001,'geom', rows_where:='id < 10');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','id < 10')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 0
NOTICE: Dead ends: 4
NOTICE: Potential gaps found near dead ends: 0
NOTICE: Intersections detected: 0
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
SELECT pgr_analyzeGraph('edges',0.001,'geom', rows_where:='id >= 10');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','id >= 10')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 2
NOTICE: Dead ends: 8
NOTICE: Potential gaps found near dead ends: 1
NOTICE: Intersections detected: 1
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
SELECT pgr_analyzeGraph('edges',0.001,'geom', rows_where:='id < 17');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','id < 17')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 0
NOTICE: Dead ends: 3
NOTICE: Potential gaps found near dead ends: 0
NOTICE: Intersections detected: 0
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
DELETE FROM edges WHERE id >= 17;
DELETE 2
UPDATE edges_vertices_pgr SET (cnt,chk) = (0,0);
UPDATE 17
SELECT pgr_analyzeGraph('edges', 0.001, 'geom');
WARNING: pgr_analyzegraph(text,double precision,text,text,text,text,text) deprecated function on v3.8.0
NOTICE: PROCESSING:
NOTICE: pgr_analyzeGraph('edges',0.001,'geom','id','source','target','true')
NOTICE: Performing checks, please wait ...
NOTICE: Analyzing for dead ends. Please wait...
NOTICE: Analyzing for gaps. Please wait...
NOTICE: Analyzing for isolated edges. Please wait...
NOTICE: Analyzing for ring geometries. Please wait...
NOTICE: Analyzing for intersections. Please wait...
NOTICE: ANALYSIS RESULTS FOR SELECTED EDGES:
NOTICE: Isolated segments: 0
NOTICE: Dead ends: 3
NOTICE: Potential gaps found near dead ends: 0
NOTICE: Intersections detected: 0
NOTICE: Ring geometries: 0
pgr_analyzegraph
------------------
OK
(1 row)
Ver también¶
pgr_nodeNetwork para crear nodos en una tabla sin nodos.
Índices y tablas