Created
September 25, 2014 17:43
-
-
Save pnorman/46fe6646cdf43eaabde9 to your computer and use it in GitHub Desktop.
SQL to generate statistics about an osm2pgsql database for verification of output
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
\x | |
SELECT COUNT(*), SUM(array_length(nodes, 1)) AS nodes, SUM(array_length(tags, 1)) AS tags FROM planet_osm_ways; | |
SELECT COUNT(*), SUM(array_length(parts, 1)) AS parts, SUM(array_length(members, 1)) AS members, SUM(array_length(tags, 1)) AS tags FROM planet_osm_rels; | |
SELECT COUNT(*) AS point_count FROM planet_osm_point; | |
SELECT COUNT(*), SUM(ST_Length(way)) AS st_length FROM planet_osm_line; | |
SELECT COUNT(*), SUM(way_area) AS way_area, SUM(ST_Area(way)) AS st_area, SUM(ST_Perimeter(way)) AS st_perimeter FROM planet_osm_polygon; | |
SELECT COUNT(*), SUM(ST_Length(way)) AS st_length FROM planet_osm_roads; | |
SELECT COUNT(*), SUM(way_area) AS way_area, SUM(ST_Area(way)) AS st_area, SUM(ST_Perimeter(way)) AS st_perimeter FROM planet_osm_polygon WHERE leisure = 'playground'; | |
SELECT COUNT(*), SUM(ST_Length(way)) AS st_length FROM planet_osm_line WHERE highway='primary'; | |
SELECT COUNT(*), SUM(ST_Length(way)) AS st_length FROM planet_osm_roads WHERE highway='primary'; | |
SELECT COUNT(*) AS point_count FROM planet_osm_point WHERE "natural"='tree'; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment