Geographic Information Systems Asked on July 25, 2021
I have a street layer with the correct direction for each line. I want to make a geocoding address based on the direction of lines and hierarchy (highway, main way, alley, etc). For example, in alley 1 i want to create a text like ( alley 1, main street 2, highway 4).Because of line 3 is an alley, this line not included in the address. I want to create this for all of the street lines in a city.
I try to use Feature vertices to point tool Compute start and end points of lines, then join the results and find the hierarchies, but sometimes it did not work.
Is there any ArcMap, Qgis or python solution for my issue?
This is a small example to mimic your case. I have named the layer as 'streets'.
I am using QGIS 3.16.3, which is equiped with overlay_touches()
expression in the Field Calculator.
The script is:
if("typeStreet" = 'main street',
concat('Alley ',
array_to_string(overlay_touches('streets', name, filter:= typeStreet = 'alley')),
', Main street ',
"name",
', Highway ',
array_to_string(overlay_touches('streets', name, filter:= typeStreet = 'highway'))
) ,
NULL)
Important part of the script is overlay_touches('streets', name, filter:= typeStreet = 'alley')
, which will extract "name" attribute from the 'streets' layer (i.e. own layer) and filter it by the typeStreet. If it is 'alley', it selects the feature fid.1, and 'highway' will be fid.4.
[Logic behind the script]
In this calculation, Main street
acts as a hub for the whole alley - main street - highway
network. It enables determination of the touching
(allay <- main street -> highway) by single command overlay_touches()
then use filter
to switch between alley/highway. So the calculation starts only if the typeStreet
is main street
, and ignore other records.
Output will be something like below.
Answered by Kazuhito on July 25, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP