Monday 29 April 2013

What is going on here? ...continued

Thanks for the interesting responses to the last past.

I'm inclined to think that the most plausible explanations are that the "spikes" are artefacts, and that most of the effect I am seeing are due to aligning buildings so they capture the sun.

However, I'm not sure it can be as simple as that.

Here is a similar plot based on the alignment of different types of road in the British Isles. The characteristics are similar to buildings: a bias towards East-West orientation, and spikes at the main points. There also seems to be quite a strong tendency for UK mappers to draw roads from West to East, which is quite interesting, but not particularly important. You wouldn't expect the same effect for buildings of course - because they need to be traced all the way round.

We could imagine the travel of the sun affecting both roads and buildings. There might be a link between the alignment of buildings and residential roads, and some other built up roads for example. But I'm not sure this would explain why all the different road types show the same effect.

The bottom line is that I can't convince myself that the travel of the sun is sufficient explanation.

My other concern is that different map projections are having an effect on my calculation of way lengths. But at the moment I can't see what the problem could be. This time I've used ST_Distance_Sphere  to calculate the distance between end points of each straight line, instead of transforming coordinates to OSGB and using ST_Length. I haven't tried ST_Distance_Spheroid yet, but perhaps I should. I understand it is more accurate, but much slower. And surely it wouldn't make enough difference to have this much effect. Or would it?

8 comments:

vdp said...

It might be interesting to redo the graphs using 180 degrees instead of 360, to smoothe out irregularities due to which direction the way was mapped (which is interesting in itself, but not what we are trying to figure out here).

As for the influence of the sun's position, one way to sort it out could be to compare the same graph for different latitudes. If the sun's position has an effect, it should become less important the closer you are to the equator. Then again, you might start to see a "morning sun vs evening sun" bias instead :)

Tim said...

Nice set of graphs. I think this may be because a few reasons:

1. Projection. In northern latitudes the North South lengths are squished. So that distances of 1 degree north looks shorter than distance 1 degree west. Try reprojecting into 900913, and use metres (and not degrees). Mappers in OSM map usually using the 900913 projection.


2. You are totalling the distance of lengths between each node. You are not giving the average (mean, median, mode) for a set length of road. This could mean that it's easier to draw lines with longer segments right to left. And at other directions, more detail and shorter segments are used. And related...

3. For buildings, you *total* the lengths for buildings. You should instead give the distribution of orientation. You give a bias towards large easily mapped buildings that are often aligned (churches) and which are totalled. A few large buildings can affect the total figure and skew the results. If you use frequency these large buildings will not skew results.

Tim said...

http://i.imgur.com/8Eph8ks.jpg

Gives an example of WGS84 vs OSGB national grid projection showing the distortion of data.

Perhaps your results are showing this.

gom1 said...
This comment has been removed by the author.
gom1 said...

On plotting around 180 degrees, good thought - it does smooth some stuff out, but it is much the same result, and I thought it was a bit easier to explain what is going on if I plotted 360.

At the moment I only have data for the British Isles on my local machine. I'd love to see someone else test this idea, because it's likely to be a long while before I get round to trying places near the equator.

On projection issues, apologies for not explaining the technique properly. The lengths I'm using are in metres. I've done that several different ways, with the same results. Re-projection to OSGB then taking line length was the first way, then I tried using Postgis ST_Distance_Sphere to achieve the same thing. For completeness, I've just re-worked it in 900913 and got the same results. If it is a problem with projections it's more subtle than that trying to measure distances in degrees.

I'm measuring total way length as drawn. I can see how variations in segment lengths will have some effect: short segments implies more detail and would result in a longer total length. Interesting idea that "horizontal" roads are more detailed then "vertical" roads, and that's easy to test. Whether this has sufficient impact is a more difficult question.

I will try and test the alignment of different sizes of building. At the moment I'm not sure that this will yield results - churches are a tiny proportion of the total, and shouldn't have a significant effect, but maybe there's another factor at work here.

gom1 said...

Many thanks to all - it is a proection problem. I should have realised that re-projection is needed for Azimuth as well as length. You live and learn.

Sorry for all the confusion, and on we go to the next stage.

Mella Robinson said...

How did you solve this problem Gom1? I'm facing the similar problem with my project. With 360 degrees it's not coming out as I want it to be. Mind sharing your solution?

gom1 said...

It's a while since I did this, so I can't easily find the code, but from memory, I transformed the geometries to a new projection (postgis= ST_Transform). The original data is in degress (WGS84=SRID 4326). I converted it to national grid (OSGB=27700), before I calculated length or azimuth. After that the results were more sensible. The later result is here - http://tlatet.blogspot.co.uk/2013/04/road-alignments-revisited.html . I thin kthe remaining bulges are probably more likely to be artefacts from mapping than differences onthe ground.