{"id":26562853,"url":"https://github.com/centrogeo/accesibilidad","last_synced_at":"2025-09-21T21:49:08.390Z","repository":{"id":81514202,"uuid":"321838661","full_name":"CentroGeo/Accesibilidad","owner":"CentroGeo","description":null,"archived":false,"fork":false,"pushed_at":"2020-12-16T01:54:25.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":7,"default_branch":"main","last_synced_at":"2025-03-22T15:41:04.187Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CentroGeo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-12-16T01:54:09.000Z","updated_at":"2020-12-16T01:54:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"2733c80e-e18c-45ea-b823-fc69734dbf39","html_url":"https://github.com/CentroGeo/Accesibilidad","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CentroGeo/Accesibilidad","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CentroGeo%2FAccesibilidad","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CentroGeo%2FAccesibilidad/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CentroGeo%2FAccesibilidad/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CentroGeo%2FAccesibilidad/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CentroGeo","download_url":"https://codeload.github.com/CentroGeo/Accesibilidad/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CentroGeo%2FAccesibilidad/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276312966,"owners_count":25620626,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-03-22T15:28:59.223Z","updated_at":"2025-09-21T21:49:08.384Z","avatar_url":"https://github.com/CentroGeo.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Cálculo índice de accesibilidad por medio de transporte \nESPECIFICACIONES: \n\nPostgis 3\nPgrouting \nPostgreSQL 13\nQgis 3.1.4\n\n========================================\n## ETAPA 1: GENERAR CLUSTERS DE HOSPITALES \n### NODO MAS CERCADO DE LA RED AL CENTROIDE DEL CLUSTER: Se asigna como primer parte del procesamiento el id del nodo  más cercano de la red a los puntos de áreas verdes \n``` sql\nalter table areas_verdes add column closest_node bigint; \nupdate areas_verdes set closest_node = c.closest_node\nfrom  \n(select b.id as id_centroid, (\n  SELECT a.id\n  FROM ways_vertices_pgr As a\n  ORDER BY b.geom \u003c-\u003e a.the_geom LIMIT 1\n)as closest_node\nfrom  areas_verdes b) as c\nwhere c.id_centroid = areas_verdes .id\n```\n## ETAPA 2: MODELO DE COSTOS POR TIPO DE TRANSPORTE\nEn la siguiente tabla se muestran las categorías por tipo de vialidad utilizadas en cuanto a la velocidad máxima permitida. Para el modelo de costos en tiempo de traslado se utilizó un factor para priorizar las cirulación por por vialidades optimas por tipo de tranporte.\n\n|class_id | type_id | name | priority | default_maxspeed|\n|  :---:  | :---:   | :---: |     :---:      |    :---:    |   \n|201 |       2 | lane              |        1 |               50|\n|204 |       2 | opposite          |        1 |               50|\n|203 |       2 | opposite_lane     |        1 |               50|\n|202 |       2 | track             |        1 |               50|\n|120 |       1 | bridleway         |        1 |               50|\n|116 |       1 | bus_guideway      |        1 |               50|\n|121 |       1 | byway             |        1 |               50|\n|118 |       1 | cycleway          |        1 |               50|\n|119 |       1 | footway           |        1 |               50|\n|111 |       1 | living_street     |        1 |               50|\n|101 |       1 | motorway          |        1 |               50|\n|103 |       1 | motorway_junction |        1 |               50|\n|102 |       1 | motorway_link     |        1 |               50|\n|117 |       1 | path              |        1 |               50|\n|114 |       1 | pedestrian        |        1 |               50|\n|106 |       1 | primary           |        1 |               50|\n|107 |       1 | primary_link      |        1 |               50|\n|110 |       1 | residential       |        1 |               50|\n|100 |       1 | road              |        1 |               50|\n|108 |       1 | secondary         |        1 |               50|\n|124 |       1 | secondary_link    |        1 |               50|\n\n```sql\nalter table ways add column longitud float;\nupdate ways set longitud = st_length(geom);\n\nalter table ways add column time float;\nupdate ways set time = longitud/maxspeed; \n```\n\n```sql\nalter table ways add column costo_bici float;\nupdate ways set costo_bici =\n  case\n    when class_id = '121' then time*0.5\n    when class_id = '118' then time*0.5\n    when class_id = '119' then time*0.5\n    else time * 10\n  end;\n```\n\n```sql\nalter table ways add column costo_carro float;\nupdate ways set costo_carro =\n  case\n    when class_id = '201' then time*0.5\n    when class_id = '101' then time*0.5\n    when class_id = '106' then time*0.5\n    when class_id = '202' then time*0.5\n    when class_id = '204' then time*0.5\n    when class_id = '203' then time*0.5\n    when class_id = '202' then time*0.5\n    else time * 10\n  end;\n```\n\n```sql\nalter table ways add column costo_caminando float;\nupdate table ways set costo_caminando = longitud/9;\n```\n\n\n## ETAPA 2: REGIONALIZACIÓN CON BASE EN CONECTIVIDAD \n\n#### NODOS CON MAYOR CENTRALIDAD: se calcula la centralidad de los nodos de la red, para filtrar por los que tienen mayore valores\n* Calcular Medidas de centralidad de red\n``` sql\nSELECT  pgr_analyzeGraph('network.ways', .1 ,'the_geom','gid','source','target');\n```\n\n\n## ETAPA 3: CALCULAR EL COSTO AGREGADO DE TODOS LOS NODOS DE LA RED CON MEJOR CENTRALIDAD HACIA TODAS LAS ÁREAS VERDES DE LA CIUDAD\n\n#### AUTOMOVIL\n``` sql\nCREATE TABLE accesibilidad_carro AS \nSELECT b.the_geom, a.*\nFROM\n(SELECT DISTINCT ON (start_vid)\n       start_vid, end_vid, agg_cost\nFROM   (SELECT * FROM pgr_dijkstraCost(\n    'select gid as id, source, target, costo_carro as cost from network.ways',\n    array(select distinct(id) from (select * from ways_vertices_pgr where cnt \u003e 40) as net ), --destino \n\tarray(select distinct(closest_node) from áreas_verdes), --origen\ndirected:=false)\n) as sub\nORDER  BY start_vid, agg_cost asc) as a\nJOIN network.ways_vertices_pgr b\nON a.start_vid = b.id\n```\n#### BICICLETA\n``` sql\nCREATE TABLE accesibilidad_bicicleta AS \nSELECT b.the_geom, a.*\nFROM\n(SELECT DISTINCT ON (start_vid)\n       start_vid, end_vid, agg_cost\nFROM   (SELECT * FROM pgr_dijkstraCost(\n    'select gid as id, source, target, costo_bici as cost from network.ways',\n    array(select distinct(id) from (select * from ways_vertices_pgr where cnt \u003e 40) as net ), --destino \n\tarray(select distinct(closest_node) from áreas_verdes), --origen\ndirected:=false)\n) as sub\nORDER  BY start_vid, agg_cost asc) as a\nJOIN network.ways_vertices_pgr b\nON a.start_vid = b.id\n```\n#### CAMINANDO\n``` sql\nCREATE TABLE accesibilidad_caminando AS \nSELECT b.the_geom, a.*\nFROM\n(SELECT DISTINCT ON (start_vid)\n       start_vid, end_vid, agg_cost\nFROM   (SELECT * FROM pgr_dijkstraCost(\n    'select gid as id, source, target, costo_caminando as cost from network.ways',\n    array(select distinct(id) from (select * from ways_vertices_pgr where cnt \u003e 40) as net ), --destino \n\tarray(select distinct(closest_node) from áreas_verdes), --origen\ndirected:=false)\n) as sub\nORDER  BY start_vid, agg_cost asc) as a\nJOIN network.ways_vertices_pgr b\nON a.start_vid = b.id\n```\n\n#### METRO\n``` sql\nCREATE TABLE accesibilidad_node_est AS \nSELECT b.the_geom, a.*\nFROM\n(SELECT DISTINCT ON (start_vid)\n       start_vid, end_vid, agg_cost\nFROM   (SELECT * FROM pgr_dijkstraCost(\n    'select gid as id, source, target, costo_caminando as cost from network.ways',\n    array(select distinct(id) from (select * from ways_vertices_pgr where cnt \u003e 40) as net ), --destino \n\tarray(select distinct(closest_node) from estaciones_metro), --origen\ndirected:=false)\n) as sub\nORDER  BY start_vid, agg_cost asc) as a\nJOIN network.ways_vertices_pgr b\nON a.start_vid = b.id\n```\n``` sql\nCREATE TABLE accesibilidad_est_av AS \nSELECT b.the_geom, a.*\nFROM\n(SELECT DISTINCT ON (start_vid)\n       start_vid, end_vid, agg_cost\nFROM   (SELECT * FROM pgr_dijkstraCost(\n    'select gid as id, source, target, costo_caminando as cost from network.ways',\n    array(select distinct(closest_node) from estaciones_metro), --destino \n\tarray(select distinct(closest_node) from areas_verdes), --origen\ndirected:=false)\n) as sub\nORDER  BY start_vid, agg_cost asc) as a\nJOIN network.ways_vertices_pgr b\nON a.start_vid = b.id\n```\n**Para representar el costo agregado en metro, sumar las columnas agg_cost de accesibilidad_est_av y accesibilidad_est_av\n__NOTA:De la tabla resultante la columna start_vid pertenece a los nodos de la red y end_vid los nodos de destino\n\nPor cada índice se crea un raster de costos con la herramienta IDW interpolando con la columna agg_cost. \nA partir de la herramienta point density se genera con las capa de delitos el raster de zonas peligrosas y se genera una realción para incrementar el costo en la intersección entre el rster de costos obtenido por el IDW\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentrogeo%2Faccesibilidad","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcentrogeo%2Faccesibilidad","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcentrogeo%2Faccesibilidad/lists"}