prochitecture / blosm Goto Github PK
View Code? Open in Web Editor NEWLicense: GNU General Public License v3.0
License: GNU General Public License v3.0
One of the instances of IntersectionArea
has a connector to the street segment with id=1066. However the key 1066 is not availabe in the dictionary waySectionLines
.
In order to create realistic streets and intersections, many of their features have to be invented by the software, as they are not provided by the OSM data. In the following posts, first problems and findings, experienced with experimental code, are discussed.
Process the centerlines of the streets, roads and paths from OSM, eventually other OSM objects (e.g. buildings)
Generate street geometry and project it on the terrain.
Place street objects (streetlights, road signs, bus stops, entrances to subway, etc) in accordance with the street PML style and orient them accordingly.
A terrain may require some automatized editing.
The issues was originally intended to discuss issues related to generation of flat roofs.
However the issue has been used to discuss the general principles of operation of the addon and Geometry Nodes. See also some discussions at #37
Original message
Flat roofs can have crazy shapes (see the images below). We have implemented a library to fit rectangles even to very complex roof shapes. I hope it will be much easier to instance roof objects (air vents, antennas, etc) on rectangles.
I started the FacadeClassification class.
A solution is sought for the processing of way-islands that are not connected to the rest of the way-section graph.
For debugging it is sometimes difficult to identify a special edge or way segment. In recent projects I introduced an ID, which is incremented for every constructor of an object. I did the same now for the classes BldgEdge and WaySegment. The id can easily accessed and used for instance in a breakpoint as egde.id==573
to identify the desired edge (similar for way-segment). The IDs of all edges can be visualized using the command-line argument --showIDs
for both, visibility and classification plots. See an example here:
Visualization of way-segments is not yet implemented, as I didn't know exactly how to transfer the flag into the super class. Maybe a task for the expert? I propose to leave these IDs until we are ready for release. Then we may remove them.
This feature is commited.
This issue is used to discuss on how to detect that a street section does not have a sidewalk on the left or on the right.
(1)
All street segments that constitute a roundabout should not have a sidewalk on the side pointing to the internal part of the roundabout.
(2)
A pair of street sections that originate or end at the neighbor connectors of an intersection. The angle between the way-segments that originate or end at the intersection should not exceed a given threshold.
Consider the data structure for a road created by offsetting its centerline.
The resulting polygons are shown on the image above. The polygon with sharp corners is on the left and the one with rounded corners is on the right.
(1)
A list with coordinates for the resulting polygon is needed. The order of the coordinates: [1R, 2R, 3R, 4R, 4L, 3L, 2L, 1L].
Additional information is needed for the case of the rounded corners. If the number of additional vertices is the same for each vertex of the original centerline, then it's enough to store that number of additional vertices for each corner.
File "blender-osm\action\facade_visibility.py", line 168, in calculateFacadeVisibility
x2 = intersections[i+1][1] * segmentLength/2.
IndexError: list index out of range
Useful GN-setups from blender.stackexchange.com, Youtube, etc.
Which method is used to detect if a polygon is inside a graph-cycle?
Forests and other objects may be mapped as relations in OSM.
A relation can be used to map any combination of
The problem is that a hole (or an inner ring) is not explicitly assigned to any outer ring. The inner ring is only marked as such.
I created a branch shared_edges to develop the code for shared edges.
The first my action was to skip shared edges. It lead to the list index out of range
in the line 164 of the module action/facade_visibility.py.
Sparsely populated areas (rural areas) require a special processing.
In your example on Piirissaar, there are almost no more graph cycles (only the red lines in the image below). In all our data sets, the density of roads was so large that the idea of graph cycles worked well. For such sparsely populated areas however, we will have to come up with something else, I assume.
Another problem is the large graph-cycle painted in red like in the image below. The circumscribed circle around this cycle is very large and includes most of the polyline objects in the scene. Their subtraction therefore takes a lot of processing time in PyGeos. The result is a large polygon with a large number of holes, which again takes a large execution time for the decomposition.
I'd like to consider different graph-cycles and describe how the polygons can be generated for them. That's needed to derive a general algorithm. After the polygons are generated for each graph-cycles, they can by joined. The widths of the resulting roads can be unified.
Example 1
The graph-cycle contains a grass polygon. We need to triangulate the sequence of edges:
Now join the triangles for each way-section. The triangles that are to be joined must have a common edge with a way-section:
The blue triangles weren't joined since they didn't have a common edge with a way-segment. However each blue triangle has a common vertex with two adjacent way-segments. We can find the projection of the triangle on those way-segments. The triangle can be attached to the way-segment with a larger triangle projection. That leads to:
Finally, the shape of the pedestrian crossings (green) should be corrected:
This issue is used to collect references to useful algorithms.
I am currently experimenting with creating terrain patches between streets:
I need to know that one or both ends of a street-section or a cluster is dead-ended.
I suggest adding the following properties to the classes TrimmedWaySection
and WayCluster
:
startConnected
(True or False)endConnected
(True or False)Object polygons may be larger than the graph-cycle they have to be subtracted from and then fail to be detected. The image below shows such a situation
The detection works as follows: The blue line is the graph-cycle polygon and the red dots are the vertices of the object polygon (green area). The vertices of the object polygon are inserted into a KD-tree and also in a dictionary, that matches the vertices to the polygon. The blue area is a circle, circumscribed to the graph-cycle polygon. All vertices of the object polygon within this circle are detected, their object identified by the dictionary and then this object is subtracted from the graph-cycle. But when the object polygon is too large, as in the depicted example, it is not detected and therefore not subtracted.
We have to find a method to make sure that all object polygons that intersect or cover the graph-cycle are detected.
In the current version of road_polygons.py there exists a mixture of different approaches, where and how way-sections are stored. These are the result of the development history and certainly need to be refactored, so that finally the triangles can be related to these sections. Within this issue I will try to explain the current state in detail. Based on this knowledge the discussion can be opened about how finally the triangles and the way-sections have to be related to get the desired result for the rendering of the streets. Since we do not yet know how this final result will be derived from the triangles, this topic may possibly also be a starting point for ideas on this topic.
This will become a rough description of the process pipeline from way-sections to triangles, including the most important data model charts. I will edit this post several times until the pipeline description is complete. Please do not yet post here until I have finished this text.
Edits:
24.03.2022: the link to definitions
To create terrain patches between streets it is required to add a border of the area of interest.
This issue is intended to discuss the above matter.
numpy is very slow in linear algebra for 2D and 3D vectors in comparison to mathutils.
I suggest discussing here if it makes sense to convert action/facade_visibility.py and action/facade_classification.py to mathutils.
Occurs for the file facade_visibility/manhattan_01.osm.
I propose to exclude the the dead-end ways from the initial processing of graph-cycles.
Once the subdivision for a graph-cycle containing a dead-end way is ready, the generated triangles are further split by the dead-end way. If the dead-end is located within a triangle, it's simply stored with that triangle.
This issue is to discuss integration of the code that calculates facade visibility.
The code should be integrated into the dev branch.
The results from the construction of trimmed way-sections and intersection polygons have to be adapted for the use with objects based on geometry nodes. Let's discuss here the details of this task.
Flat roofs contain air-vents, entrances to the roof, chimneys and other stuff. The problem is how to position them on the flat roof. It's easy to position the roof element within a rectangle. For example, predefined arrangement of the roof elements can be used for each group of the rectangle sizes.
The problem can be reformulated in the following way: how to fit a number of rectangles with the given minimum dimension to a building footprint which can contain one or more holes.
It's easy to fit a rectangle to a quadrangle:
I suggest to skip single narrow facades from the visibility and classification calculations.
A single narrow facades is the one surrounded by wide facades. It has a width below some threshold.
If narrow facades are introduced, the method for assigning the side facades must be changed.
Suppose we have a sequence: Front_Facade, Narrow_Facade, Unclassified_Facade.
Unclassified_Facade should be classified as the side one.
The discussion in this issue is related to the documentation From Way-Sections to Triangles in issue #39. Starting from way-sections, neighboring or otherwise relevant triangles have to be found to collect the required shapes for a realistic street rendering by the addon. In this issue, I like to discuss the problems that may arise in this process and their possible solutions.
On the way to error free results for triangulations, I like to note some solved issues, just to remember the reasons for these bug fixes.
I've just started to learn Geometry Nodes. So my knowledge about them is limited at the moment.
Here is my current understanding. The task is to instance different Blender objects representing facade and roof parts on generated vertices. So each vertex corresponds to a specific instance of a Blender object. The instance must be rotated and scaled accordingly.
But where to get the values for the rotation and scale of the instance in question?
Also there is a need to somehow indicated which Blender object should be instanced at the given vertex.
I suggest to pass that information as attributes of vertices:
I haven't tested yet if this approach would work.
There is a bug in action/generate_streets.py, line 590: distance of the way's centerline from the left border of the cluster is always zero.
On a different note. I'd prefer to have an offset from the cluster's centerline instead of the distance from the left border of the cluster.
GN are applied to building footprints created in the "2D" mode of the addon. A scene like in the link will be created.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.