Open street map- street

Hi guys,
I am developing a game in unity based on multiple real city.
I imported buildings correctly from open street map to blender, and after some work in unity.
Now I need to redo the same thing for the streets.
I import the streets from Osm using this: https://github.com/vvoovv/blender-geo/wiki/Import-OpenStreetMap-(.osm)
But the streets are only line. What is the best way to transform this line in streets? I need a simple plan with a texture, is there a modifier to transform line in plane quickly?
I should replicate this process to many cities, so I prefer to use a quick approach, the best graphics is not needed. if It’s manually I cannot use hundred operations.

Maybe if there is some modifiers that transform the line in plane, or an extrusion is the way(I prefer an extrusion on the right and on the left otherways the street position are not real)? I can apply a street texture
Any ideas?

Thanks so much

A really fast way is to convert the lines to curve objects, then bevel the objects with a bevel object that should be a totally straight curve object. Put the bevel object at World origin and play with the rotation to get correct results.

Though this method could lead to artifacts in junctions if your lines are all in one plane in space.

It’s perfect! Thanks so much!
@eppo the add-on is very useful!

I have another little question: At now I have the streets but each street is not made by only one face, maybe 20. If I select 2 or 3 streets I can dissolve faces but why If I select all the streets (only one big mesh) I cannot use the dissolve faces command?


It’s impossible to redo dissolve faces for each couple of streets because it takes too many hours. And If I have so many faces also the plugin is not useful.

Attachments


As for the resolution, you can lower it:

  • select your ‘bevel object’
  • Object Data --> Shape --> Resolution --> Preview U
    lower it to 2, if you don’t need more and make shure that it has no more than 2 verts

“I have the streets but each street is not made by only one face, maybe 20” - should not be the case if you had 1 line initially which you converted to curve to get the width.
http://www.pasteall.org/pic/show.php?id=102864

Thank you so much! You solve all my problems!
@helluvamesh thanks, I prefer use only depht and to scale z to 0, but a bevel object is a valid alternative!

Hi guys, I write here to avoid to open a new thread. Now I have the streets but I’d like to have the white line in the middle of the street, Is it possibile? Because with textures and bake it seems complicated but without at least the line, the streets are not realistic!
Thanks guys!

This is as simple as keeping first street edge grid duplicated and hidden. Make streets as before, unhide copy and make another set; for curves there is a shift parameter you can adjust center position. Use 2d boolean again to join.

That said - texturing would be more sane.

Thanks, I tought the same. In this case the plugin is very useful!
But there is a way to have a broken line in the middle and not a simple continuous line?

There is a handy Select menu, Checker Deselect. This would allow deselect every other face to delete on the stripe you get from curve conversion. Hope 2D bool addon wont have problems with such a mesh.
But as i said, if i were you i’d try to use Follow active Quad unwrap and texturing instead. Street mesh you end up building would be quite a heavy thing plus there will be even length problems i think.

My idea was to find a function to have a dotted line instead of continuous by geometry. And after to bake all and use as a texture.
But now even a continuous line is good.
I tried with follow active quad but it doesn’t work. Maybe because the streets are not a series of multiple quad?
In any case I attached a photo, after that I press follow active quad but I don’t see any change. What’s the problem?

If this way doesn’t work there are other ways to insert this middle line?

Thanks for the suggest, Maybe a procedural way is better but for computational and not computational problem I need a static/manually method that can be replicated for other streets.

Thanks so much for all!

Attachments


Well… Seems like they are right saying that n-gons and what looks like still not quite a clean mesh are not the best candidates for UV mapping…
N-gons would produce triangles behind the scenes - these ruin all; mesh errors would do the same.
Here i did try a segment from the image; on a normally extruded mesh best was just UV-Reset and rotate in UV editor selected in 3d view faces where image had a clear 90 deg rotation in 3d view.
Manual cleanup, no further ideas on this.

I know it’s solved, but I thought a skin modifier could do the trick and it kind of works in three simple steps: Import > apply skin modifier > delete half the vertices. I never used this modifier before and I wondered, why is there no way to control the thickness of the generated mesh? Or did I just miss something? Sorry for abusing this thread, I didn’t want to open a new one and maybe it could be a good solution to turn lines into planes, if there only were a way to adjust the widthof the generated planes.

Attachments


@ marekv - Ctrl-A on selected skeleton points does scale in Skin modifier. Could be that modifier can be used.

This method looks interesting, with quad I can apply the texture, but I have a stupid problem:
I apply the skin modifier, you can see the attached image, but It works only for a segment, why?

If I select manually every segment without the join it works, but I can’t select manually each street.

So I joined the streets in one single object but the modifiers works only for a segment. All the others streets had only a subdivision of ours edges. Any suggest?

Attachments


You could temporarily separate street lines into own objects (in edit mode select all, P key - Loose Parts), add Skin to one, select the rest of the line objects and link modifiers Ctrl-L but then you’d need to adjust skin size for each individually…

Rather paste this into Text editor window, select separated street objects and press RunScript (make backup blend file first!).
Change ‘resize’ to what values you’d need.


import bpy
context = bpy.context
scene = context.scene

# Change values here:
resize=(0.2, 0.2, 0.2)

selected_objects = context.selected_objects

for item in selected_objects:
    scene.objects.active = item
    bpy.ops.object.modifier_add(type='SKIN')
    bpy.ops.object.editmode_toggle()
    bpy.ops.mesh.select_all(action='SELECT')
    bpy.ops.transform.skin_resize(value=resize)
    bpy.ops.object.editmode_toggle()
    bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Skin")


Select and join back into one object.

First of all thanks for the help,
I separated the streets, applied modifiers on 1 street(1object), I press A to select all the streets and i perss CTRL-L -Modifiers. But It doesn’t work. What’s wrong?

So I tried with the script, I select all the separated objects/streets and I press run the script. Is It Right? But It doesn’t work.
The script works only If I select only one street and applied the skin. If I select another street after the first, it doesn’t work.
What’s the problem?

This is the project with the streets: http://www.pasteall.org/blend/42226

Attachments


Certainly for this size of the mesh resize value 0.2 is too small.

This was just a beginning of a real life :wink: - Skin modifier refuses to do anything unless one vertex is marked as active. Mind you, not the all mesh needs this; on simple example primitives i did not see this. On your mesh however most part of the lines need one active vertex set as a Root for the Skin modifier and script had to be changed.
This however does not solve all problems too - segments in your file seem to have some (unclear for me; objects scale was 1) differences besides being of different length which Skin manages to pick up; since there is no way to programmatically set absolute skin width value, resize makes skin at least visible but width is different.

Feel free to experiment with this modified code. You could try to join more lines for a better result (make sure there are no doubles before you add a Skin).


import bpy, bmesh
context = bpy.context
scene = context.scene       


# Change values here:
resize=(6,6,6)

selected_objects = context.selected_objects

for item in selected_objects:
    scene.objects.active = item

    bpy.ops.object.editmode_toggle()

    mesh=bmesh.from_edit_mesh(item.data)
    for v in mesh.verts:
        v.select = True
    if hasattr(mesh.verts, "ensure_lookup_table"): 
        mesh.verts.ensure_lookup_table()
    mesh.select_history.add(mesh.verts[1])
    bpy.ops.object.modifier_add(type='SKIN')  
    bpy.ops.object.skin_root_mark()
    bpy.ops.transform.skin_resize(value=resize)
    bpy.ops.object.editmode_toggle()
    
    #Uncomment next line for a permanent mesh change
    #bpy.ops.object.modifier_apply(apply_as='DATA', modifier="Skin")