Part 1 - Aligning Points to Transportation
Imagine that you have a finite but bounded number of polygons. Each polygon represents an area that can be occupied by a building. What you would like to do is automatically place a point within each of these polygons that would completely define the location and orientation of a specific building model. The selected building model must fit completely within the provided region. The polygons below are reasonable examples of these polygon regions:
These polygons will have irregular shapes; some of them will be pointed, rounded or elongated. If we need to place a point in these geometries, where should it be placed? The first-place one would attempt to place a point is at the polygons "center". Unfortunately, the definition of center is not always clear; consider the example geometry below:
Simply summing the x and y values of this geometry and then averaging will result in a point that is positioned in the upper-left hand corner. This is due to the geometries point density in this area. Naturally, we would expect our point to be placed somewhere towards the center of the whole-geometry, as observed in the example below:
This is more along the lines of what we would expect. If we were to place a 3D model in-and-around this point, we would have lots of wiggle room. Unfortunately, a position like this is not always guaranteed to exist, as is the case with many concave geometries. This topic will be discussed in a future posting. For now, let's consider a large area that contains many of these simple cases:
If we wish to assign building models to these points, we will need to know which way they should face. After all, it would be nice if our building models were facing the street. Lets consider some examples and see if we can come up with a generalized approach for selecting an orientation angle.
Let's start our analysis by making some general observations of the input:
- More than one valid orientation may exist for each area of interest
- If an orientation can not be established by examining an individual area, we could use neighboring areas to make a good guess.
The most trivial approach to point orientation can be realized by aligning a point to the nearest transportation feature. This is a poor choice for most cases but it is reasonably trivial to implement and worth some discussion. I have roughly 400k areas in my test data set and it takes a minute to generate these sample points and orient them to the roads. The screenshot below illustrates the types of anomalies that are produced when you align to the closest point on the transportation feature.
We can see how the results may vary with this approach when more than one orientation exists. The screenshot below highlights some of the obvious complexities.
This method does not provide a general purpose solution but it does illustrate most of the fundamental issues that are involved with choosing an orientation for building model placement. In part 2, I will discuss how to improve the alignment of the orientation segment and greatly simplify the resulting model fitting process. Below are some screenshots of different sample areas.
Large area, generally acceptable results
Generally acceptable results
The closest vert is not always where you think it is...
What do we do when multiple solutions exist?