Take the 2-minute tour ×

Hi I am writing a project and I am stuck: can anyone explain as simply as possible how to calculate the visible sky percentage?

I have done a satellite survey and have worked out the height of buildings and the distance between them. How do I use that data to calculate the visible sky percentage according to where I was standing? If possible, could you show an example.


share|improve this question

4 Answers 4

We usually have data concerning where the ground is, so we have to use that. The ground determines a solid figure in 3D. You project this figure radially onto the unit sphere centered at the viewer: this maps the ground onto a region in the sphere. Compute the area of the remaining region: that's the solid angle subtended by the sky (in steradians). Divide it by the total area of the sphere (equal to 4 pi) and multiply by 100 to get the sky percentage.

If you prefer a more vivid explanation, put the viewer at the center of a small spherical bubble and ask her to paint over the sky. Divide the amount of paint she uses by the amount needed to paint the entire bubble and multiply by 100.

In reality there are some not-so-simple technical details.

The projection onto the sphere is fairly straightforward when the ground is given as a triangulated network (a TIN), because you only have to write code to project a triangle onto a sphere. When the ground is given as a gridded elevation model (a DEM), you can conceive of each grid cell as a 3D quadrilateral. You might break that into two triangles along a diagonal and map each triangle onto the sphere. In either case you're left with a collection of projected triangles on the sphere. By projecting the sphere onto a map (e.g., with a stereographic projection) the aggregation of these triangles into a polygonal region can be reduced to a standard problem of plane computational geometry (using a plane sweep method, for instance). The rest is easy (for a GIS).

This image shows a small city of simulated skyscrapers in a gnomonic projection centered at a viewer downtown looking straight up. The GIS can "merge" (form the union of) the polygons representing the sides and roofs of these buildings and then compute the area of the (white) space remaining. A gnomonic projection was chosen because the straight architectural lines are rendered as line segments rather than curves.

Simulated buildings


A GIS can be placed into service to do this calculation when you have just a ground and buildings. The buildings are most likely available as collections of rectangles. A vertex of a rectangle has Euclidean coordinates (x,y,z) relative to a viewer. Convert those to spherical coordinates: that is, latitude and longitude. Create a polygon for the converted rectangle. Do this for all rectangles for all parts of all buildings, resulting in a "polygon feature layer". Then, in the GIS, (1) compute the set-theoretic union of the features, (2) calculate the resulting area, (3) subtract this from half the surface area of the earth (the other half is for the ground), and (4) divide by the whole area of the earth (multiplying by 100 to get a percentage). The computational effort is proportional to N*log(N) where N is the number of vertices. The accuracy depends on how well the GIS represents the rectangles (you might need to break rectangle sides into sequences of more closely spaced vertices). Depending on your accuracy requirements, you might consider Monte-Carlo based approaches (e.g., the ray tracing advocated in another reply) once you have more than several hundred thousand vertices--that is, once the viewer is completely surrounded by (and can see parts of) tens of thousands of buildings :-).

share|improve this answer
thanks for your reply –  user2441 Mar 23 '11 at 22:15
i have done a sattelite survey and have worked out the height of buildings and the distance between them how do i use that data to calculate the visible sky percentage according to where i was standing? and if possible could you show an example, i should have written this in the first place sorry –  user2441 Mar 23 '11 at 22:19
@chris It's ok to edit your original question. Just indicate what aspects of the question you have modified so people understand the context of any existing answers and comments. –  whuber Mar 23 '11 at 23:17
You may want to make it more explicit that there's a union step required after projection to prevent double-counting overlapping occluders? –  Dan S. Mar 24 '11 at 0:06
@Dan The word "union" is right there in the original at step 1 :-). –  whuber Mar 24 '11 at 14:10

Here's an answer that comes from the computer graphics world rather than GIS -- hence, it's a description of an algorithm rather than instructions for which tool(s) to use.

Definition: a ray is an origin + a direction; it is the line that begins at the origin and continues to infinity along that direction.

You need the following basic ingredients:

  • Ability to test to see if a given ray hits the ground.

  • Ability to test to see if a given ray hits a building.

  • All your data (the buildings, information that represents the ground) in a 3D cartesian coordinate space.

The exact formulas to implement for ray tests depend on how you represent "the ground" (a perfect sphere? terrain?) and "a building" (an extruded rectangle? a full 3D model?). For simple geometry, they're easy to find and easy to implement. (e.g, search for "ray cube intersection").

In any case, from there the answer as to % of sky visibility from a point is trivial: Fire off a lot of rays with random directions from your query point. The proportion of sky that is visible from your test point is equal to the number of rays that did not hit a building or the ground.

The answer is not exact, but you can compute it to any desired level of precision by just adding more rays.

As describe above, it's not necessarily very fast; but there's a huge body of well-documented optimisations you can apply.

(I would expect that, for calculating sky visibility across a number of points and the same buildings dataset, this approach would blow reprojection-based approaches out of the water after the addition of a simple spatial index.)

share|improve this answer
The main problem is that the accuracy increases only with the square root of the number of rays. If the sky percentage is 50%, for instance, you need 100 rays to get 5% accuracy (which really means you are about 95% confident of getting within +-10%), 10,000 rays to get 0.5%, 1,000,000 to get 0.05%, (three digits), etc. –  whuber Mar 23 '11 at 23:51
@whuber I agree, but (1) for the question as described, accuracy beyond a digit or two is a fools' errand, and (2) adaptive sampling would fall into the "huge body of well-documented optimizations" I hand-waved past ;). Whether it's the "best" approach is certainly quite situational, however. –  Dan S. Mar 24 '11 at 0:04
@Dan OK, adaptive sampling is a good idea. But how does one carry it out in practice? Suppose you have a DEM and, say, a few dozen buildings in the vicinity. How would the algorithm work, precisely? It's difficult to imagine an effective algorithm that would be simpler or more accurate than a direct calculation of the sky coverage. –  whuber Mar 24 '11 at 14:09
@whuber I'll reply in a couple of parts... The first: Adaptive sampling boils down to biasing rays to where they're more likely to provide information and then accounting for the bias when integrating. A simple, effective, approach would be to perform a uniform initial sampling, then recursively subdivide & resample half-spaces that were sufficiently non-uniform. Final answer = weighted average of samples (weight = area of the sample's containing search space). –  Dan S. Mar 24 '11 at 16:25
On accuracy: Adaptive sampling means that accuracy is harder to reason about. You get the same baseline accuracy as you would from the initial uniform samples, plus additional accuracy that's highly dependent on the adaptation technique and the scale of high-frequency features in the scene geometry. However, I believe that in a "real world" situation you would be able to converge to an error % less than that of the source data quite quickly. –  Dan S. Mar 24 '11 at 16:33

Ecotect (now an AutoDesk tool) enables you to do this. More generally, this is frequently examined in the area of daylighting and a tool from this field might be easier to use, than GIS. (Though I have heard of a GIS plugin that can do this and calculate solar exposure, but I've never managed to find it).

share|improve this answer
ESRI's Solar Analyst? (It works by creating a grid of the projected sky and then summarizing the grid.) –  whuber Mar 24 '11 at 15:59
I thought that was only suitable for vegetation and did not consider overshadowing of buildings, etc. esri.com/software/arcgis/extensions/spatialanalyst/solar.html The help file mentions that it considers topography, but not buildings for example: help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/… –  djq Mar 24 '11 at 16:46
buildings (at least those without overhangs) can easily be "burned into" grids. That's probably not an efficient way to go about it because you need a small cell size (and Solar Analyst has its own limitations...). I just thought you might have been thinking of it. –  whuber Mar 24 '11 at 19:35
@whuber I was thinking more about the solar exposure of walls (for example what area is south facing). I assumed that the calculation only considers the grid cell area, and not the 'wall' (pixels, rather than voxels might be another way of describing it). –  djq Mar 24 '11 at 19:43

In GRASS GIS version 7 (actually not stable) there is the command r.skyview (based on the command r.horizon, available also in the stable GRASS v.6).

It reads a raster image representing a terrain model, with pixel value corresponding to terrain feature heights (e.g. building heights) and calculates, for each pixel, the "skyview factor".

You need first to convert your data (unknown format) to a raster dataset.




share|improve this answer

Your Answer

