3

I have a building and street shapefile of a district. I am looking for a way to select and eventually extract those lines or edges of the buildings that face the street.

however the extracted edges for each building need to be somehow grouped or merged into 1 line since on the next step i need to create certain number of points on the lines based on a value given for each building.

Is there anyway to do this?

an image of the buildings and streets

2
  • 3
    Are your buildings all rectangular? Do you have any round buildings? What about buildings on a street corner? What about rectangular buildings that don't line up with streets? Is your street data the road centerline or road edges? What does it all look like? Can you show us a sample map? Do you just want to end up with a layer of detached building edges as line features with or without relation to the building they came from?
    – Spacedman
    Mar 11 at 18:15
  • Thanks for following up. so the buildings are in rectangular or similar shapes. and the streets are simple lines. (unfortunately i could not add image here to show it). what i am trying to is, i have the centeroids of the buildings as points with populations as their values. i need to distribute these population values into random number of points and align them along those edges of buildings that face the street. so if a building faces two streets, then algning along both. for aligning i am using "snap to geometry". so i was thinking of extracting the street fracing edges first.
    – murph21
    Mar 11 at 18:42
0

A (partial) solution could look like this:

On the polygon layer with your buidings, create the point that is closest to the nearest segment of the street layer. You can use expressions with geometry generator (for visualization purposes only) or Menu Processing / Toolbox / Geoemtry by expression to create actual geometries as a separate point layer.

In both cases, use the following expression. For the purpose here, use Geoemtry by expression to create a new layer named 'closest_point':

closest_point( 
    $geometry, 
    collect_geometries (
        overlay_nearest( 
            'highway', 
            $geometry
        )
    )
)

enter image description here

You than can convert your polygons to lines and explode these lines - to have a separate feature for each segment of the line surrounding your buildings. On this explodes line layer, use select by expression with the expression overlay_touches( 'closest_point').

You can copy the selected lines to a new layer. This should give you in many cases the result you want - see the red lines on the next screenshot. However, things can be tricky in all the cases mentioned in the comment by @Spacedman. So you should reflect clearly how to solve such cases. As you can see, there are many problems and I fear you have to address them one by one. But at least you have a starting point.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.