Skip to content

OSMBuildings/pg-shadows

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

pg-shadows

This custom function adds shadow calculation to PostGIS.

Usage

Shadow(ARRAY[azimuth decimal, altitude decimal], geometry, height)

  • ARRAY[azimuth, altitude] should be calculated on your side i.e. by Mourner's suncalc. We might add an appropriate SQL function later on.
  • azimuth is horizontal angle in decimal degrees, orign north.
  • altitude is vertical angle in decimal degrees.
  • geometry is your geometry, i.e. building footprint
  • height is your object's height in meters

Returns polygon geometry which you can use for shadow visualization or for intersection tests.

Example

SELECT
  ST_AsGeoJSON(ST_Transform(way, 4326))::json AS geometry,
  ST_AsGeoJSON(
    ST_Transform(
      Shadow(ARRAY[90, 5], way, 25),
    4326)
  )::json AS shadow
FROM
  planet_osm_polygon
WHERE
  osm_id = 313670734

About

Shadow calculation in POSTGIS

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published