Calculating Street Intersection Density (QGIS3) — ...

Calculating Street Intersection Density (QGIS3)¶

Street intersection density is a useful measure of network connectivity. One can extract and aggregate street intersections over a regular grid to calculate the density. This analysis is commonly used in transportation design as well as urban planning to determine walkability of neighborhoods. With the availability of global street network dataset from OpenStreetMap and QGIS, we can easily calculate and visualize intersection density for any region of the world.

Overview of the task¶

In this tutorial, we will take OpenStreetMap road network data and calculate the street intersection density for the city of Chennai in India.

Other skills you will learn¶

  • How to download OpenStreetMap data as shapefiles and clip it to your area of interest.

  • How to create grids in QGIS.

Get the data¶

We will use the data from opencities to get the city boundary for Chennai and, then the road network data from OpenStreetMap Data Extracts for India.

Download the City Boundary¶

  1. Visit the opencity website, then search for “Chennai wards map”.

  1. Click on the first link and download the data in KML format. A layer Chennai-wards-2011.kml will be downloaded.

Download the Road Network¶

  1. Visit the OpenStreetMap Data Extracts download server by GEOFABRIK. For this tutorial, we need the data for the city of Chennai in India. Click Asia.

  1. Now in sub-regions, select India.

  1. The india-latest-free.shp.zip is the file we are looking for click it to download, this data can be downloaded in other formats also as per requirement.

  1. This is a large download containing an extract of data for the entire country. Unzip the india-latest-free.shp.zip. You will get many shapefile layers.

Clip the Road Network to the City Boundary¶

  1. We will now clip the country-level roads layer to our area of interest. Open QGIS, and drag and drop the Chennai-wards-2011.kml.

  1. Instead of opening a large layer in QGIS, we can directly read it from the disk and clip it. Open the Processing Toolbox and locate the Vector overlay ‣ Clip. Double-click to open it.

  1. In the Input layer select the and click on Browse for Layer…

  1. Navigate to the directory where you downloaded the OpenStreetMap data and select gis_osm_roads_free_1.shp. In the Overlay layer choose New Wards from Oct 2011. Then click in Clipped and select Save to File…, browse to a folder where you want to save the results, enter the name as chennai_roads.gpkg, and click Run.

  1. Once the processing finishes, a new layer chennai_road will be loaded in the canvas.

For convenience, you may directly download a copy of the clipped dataset from the link below:

Data source: [OPENCITIES] [GEOFABRIK]

Procedure¶

  1. Now both layers used for the calculation will be available, if you have downloaded the data, then locate the Chennai-Wards-2011.kml and chennai_roads.gpkg in Browser, then drag and drop them on canvas.

  1. The first task is to extract the road intersections. This can be done using the built-in Line intersections tool. Let’s test this on a small subset first to see if the results are satisfactory. Select the roads layer, and use the Select features by Area tool to draw a rectangle and select a few roads.

  1. Open the Processing Toolbox and locate the Vector overlay ‣ Line intersections tool. Double-click to open it.

  1. Select chennai_roads as both Input layer and Intersect layer. Make sure to check the Selected features only. Click Run.

  1. A new layer Intersections will be added. You will notice that while most intersection points are correct, there are some false positives. This is because the algorithm considers intersections of each line segment as a valid intersection. But for our analysis, we need to extract only the intersections when 2 or more streets intersect.

  1. Remove the Intersections layer and click Deselect features from all layers button to remove the selection. We will now merge all adjacent road segments, so the segments between intersections are merged into a single feature. Open the Processing Toolbox and locate the Vector geometry ‣ Dissolve tool. Double-click to open it.

  1. Select chennai_roads as the Input layer. Enter the Dissolved output layer name as roads_dissolved.gpkg. Click Run.

  1. The resulting layer roads_dissolved has all the road segments merged into a single feature.

  1. Next, open the Processing Toolbox and locate Vector geometry ‣ Multipart to single parts tool. Double-click to open it. Select roads_dissolved layer as the Input layer. Enter roads_singleparts.gpkg as the Single parts output. Click Run.

  1. The resulting layer roads_singleparts will have all adjacent segments merged, remove the roads_dissolved and chennai_roads layers. Now, open the Processing Toolbox and locate Vector overlay ‣ Line intersections algorithm. Double-click to launch it.

  1. Select roads_singleparts as both the Input layer and the Intersect layer. Name the Intersections output layer as roads_line_intersections.gpkg. Click Run.

Note

This is a computationally intensive operation and may take a long time depending on your computer processing capacity.

  1. The resulting layer roads_line_intersections now have all intersections correctly identified. But it is still not perfect. Use the Select features by Area tool and select any intersection. You will see that at each intersection there are few duplicate points from adjacent segments. If we use this layer for further analysis, it will result in an inflated number of intersections. Let’s remove duplicates, open the Processing Toolbox and locate the Vector general ‣ Delete duplicate geometries tool. Select roads_line_intersections as the Input layer and enter road_intersections.gpkg as the Cleaned output layer. Click Run.

  1. The new layer road_intersections layer has the correct number of road intersections extracted from the source layer. Right-click the old road_line_intersections layer and select Remove layer to remove it.

  1. We will now compute the density of points by overlaying a regular grid and counting points in each grid polygon. We must reproject the data to a projected CRS so we can use linear units of measurements. We can use an appropriate CRS based on the UTM zone where the city is located. You can see UTM Grid Zones of the World map to locate the UTM zone for your city. Chennai falls in the UTM Zone 44N. Open the Processing Toolbox and locate the Vector general ‣ Reproject layer. Double click to open it.

  1. Select road_intersections as the Input layer. Search by clicking the globe icon next to Target CRS and select EPSG:32664 - WGS 84 / UTM zone 44N. This is a CRS based on the WGS84 datum for the UTM Zone 44N. Enter the Reprojected output layer as road_intersections_reprojected.gpkg. Click Run.

  1. Once the processing finishes and the road_intersections_reprojected layer is added, right-click and select Layer CRS ‣ Set Project CRS from Layer. And remove the road_intersections layer.

  1. Now we can create the grid. Open the Processing Toolbox and locate the Vector creation ‣ Create grid. Double click to open.

  1. Select Grid type as Rectangle (Polygon). Click the ... button in Grid extent and select Calculate from Layer ‣ road_intersections_reprojected.

  1. Select the Project CRS as the Grid CRS. We want to create a grid of 1km x 1km, so set both Horizontal spacing and Vertical spacing as 1000 meters. Save the Grid output layer as grid.gpkg. Click Run.

  1. The grid layer containing rectangular grid polygons will be created. We can now count the number of points in each polygon, but since our layers are large, this process can take a long time. One way to speed up spatial operations is to use a Spatial Index. Open the Processing Toolbox and locate the Vector general ‣ Create spatial index tool. Double click to open it.

  1. Select grid layer and click Run, now the layer will have spatial index which can boost the performance of computation with this layer.

  1. Open the Processing Toolbox and locate the Vector analysis ‣ Count points in polygon algorithm.

  1. Select grid as the Polygon layer and road_intersections_reprojected as the Points layer. Save the Count output layer as grid_count.gpkg. Click Run.

  1. The resulting layer grid_count will have an attribute NUMPOINTS which contains the number of intersection points within each grid. There are many grids with 0 points. It will help our analysis and visualization to remove grid polygons that contain no intersections. Open the Processing Toolbox and locate the Vector selection ‣ Extract by attribute algorithm.

  1. Select grid_count as the Input layer, then select NUMPOINTS in Selection attribute, > in Operator and enter 0 as the Value. Save the Extracted (attribute) output layer as grid_counts_chennai.gpkg. Click Run.

  1. The resulting layer grid_counts_chennai will have grid polygons over the chennai city and contains the number of road intersections as an attribute for each polygon. Remove all layers except grid_counts_chennai.

  1. Let’s clean up the attribute table of our data layer. The preferred method to make any changes to the attribute table is to use a processing algorithm called Refactor Fields, open the Processing Toolbox and locate the Vector table ‣ Refactor Fields. Double-click to open it. Click on any row in the Field Mapping section to select it. You can hold the Shift key to select multiple rows, select all fields except fid and NUMPOINTS. Click the Delete selected fields button.

  1. Rename the NUMPOINTS as intersection_density and save the layer as road_intersection_density.gpkg, click Run.

  1. Let’s style this layer to view the density of each grid, select the road_intersection_density layer and click Open the Layer Styling Panel. Select Graduated renderer, and in Values select Intersection Density, a Color ramp of your choice, set the classes to 7 and click Classify.

  1. In the values enter 0-50, 50-100, 100-150 and so on upto 300 - 350. You have now created a map showing intersection density across the city.

(0)

相关推荐

  • 【商业教程】Pyro烟火完全入门第二卷

    --  微资讯 · 微课程  -- 利用零碎时间,走上超神之路! 说明:由于本教程是商业教程,仅分享学习笔记,供大家学习交流使用,切勿用于商业用途,公众号不方便分享视频内容,大家可以在网络自行查找:对 ...

  • 台达_OBC双向充电_High-Efficiency High-Density GaN-Based ...

    欢迎加入技术交流QQ群(2000人):电力电子技术与新能源 1105621549 高可靠新能源行业顶尖自媒体 在这里有电力电子.新能源干货.行业发展趋势分析.最新产品介绍.众多技术达人与您分享经验,欢 ...

  • 每周精选|视频开箱剑桥一房项目 51a geroge street

    剑桥优质别墅 项目 – 51a George Street 位于剑桥市中心僻静的住宅区,此项目是难得一见的一居室别墅项目,整体设计以当代风格为主,别具有一番风味.项目邻近River Cam 坎河,沿路 ...

  • 作图篇:python密度图(Density Plot)

            在概率论与统计学习方法中,可视化概率密度就变得非常重要了.这种密度图正是可视化连续型随机变量分布的利器,分布曲线上的每一个点都是概率密度,分布曲线下的每一段面积都是特定情况的概率.如下 ...

  • 廖彩杏经典英文绘本推荐《On Market Street》认识字母简单学

    绘本简介:又是一本经典的字母书.艾诺·洛贝尔(Arnold Lobel),是美国著名童书作家及画家,艾诺·洛贝尔(Arnold Lobel)被称为最懂得尊重儿童智慧的作家,他以简单.优美的文字和艺术表 ...

  • 街角遇见的神迹 Street Artist Zilda

    魔女蓝:我一直关注着国外的街头艺术家,因为有太多才华横溢的画家们在街头施展魔法,把墙面当作自己的舞台.Zilda就是这么一个在意大利很活跃的街头艺术家,他的精湛古典油画技巧在街头喷绘的时候将古希腊神话 ...

  • Street Artist: Lonac 克罗地亚的街头艺术家罗纳

    魔女蓝:好久没有介绍街头艺术家了,实际上之前我只推荐了一个,近些年来许多最有才华的青年艺术家都活跃在街头,其中最吸引我的都是些超现实主义题材的作品,今天就介绍一下这位来自克罗地亚的青年艺术家的作品. ...

  • 也许无法重启,但可以重生 ▏Street Art 2020

    Grime or Sublime? 看看新冠下的街头文化--涂鸦艺术 街头涂鸦艺术通常会给人两极化的看法,有人认为它是一种破坏,疯狂和恐吓,也有人则认为涂鸦是一种真正的美学性产物. 2020年,全世界 ...

  • With Fed''s Reverse Repo Hitting Half A Trillion, Wall Street Scrambles To Figure Out What C

    2 days ago 7 images With Fed's Reverse Repo Hitting Half A Trillion, Wall Street Scrambles To Figure ...

  • 职场中,既需要school smart,更需要street smart

    曾和朋友们讨论过职场中是需要school smart还是street smart? School smart中文翻译成"学校智慧",也可以理解为理论派. 比如,有些人做事总是循规蹈 ...

  • [第216次听写]on a street vs in a street

    我是Wind, 以前是字幕组组长. 我每天早上听写1分钟美剧, 已经坚持7个月了. 你想不想找一种轻松愉快的方式提升自己的英语? 跟我一起每天做听写吧! Wind大长图节选 每天早上我会创作一张Win ...