Created
August 4, 2014 22:18
-
-
Save jatorre/ff39d8e195fb286992ef to your computer and use it in GitHub Desktop.
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
http://osmbuildings.cartodb.com/api/v2/sql?format=geojson&dp=6&q=SELECT%20cartodb_id%2CST_Intersection(CASE%20WHEN%20ST_Dimension(ST_Snap(ST_CollectionExtract(ST_SnapToGrid(ST_CollectionExtract(ST_Simplify(%22the_geom%22%2C%200.03055572509765625)%2C%20ST_Dimension(%22the_geom%22)%20%2B%201)%2C%200.0611114501953125)%2C%20ST_Dimension(%22the_geom%22)%20%2B%201)%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-35.947265625%2C19.89072302399691%2C-20.302734375%2C33.797408767572485%2C%204326)%2C%207.3333740234375)%2C0.0611114501953125)%2C%200.0611114501953125))%20%3D%200%20OR%20GeometryType(ST_Snap(ST_CollectionExtract(ST_SnapToGrid(ST_CollectionExtract(ST_Simplify(%22the_geom%22%2C%200.03055572509765625)%2C%20ST_Dimension(%22the_geom%22)%20%2B%201)%2C%200.0611114501953125)%2C%20ST_Dimension(%22the_geom%22)%20%2B%201)%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-35.947265625%2C19.89072302399691%2C-20.302734375%2C33.797408767572485%2C%204326)%2C%207.3333740234375)%2C0.0611114501953125)%2C%200.0611114501953125))%20%3D%20%27GEOMETRYCOLLECTION%27%20THEN%20ST_Snap(ST_CollectionExtract(ST_SnapToGrid(ST_CollectionExtract(ST_Simplify(%22the_geom%22%2C%200.03055572509765625)%2C%20ST_Dimension(%22the_geom%22)%20%2B%201)%2C%200.0611114501953125)%2C%20ST_Dimension(%22the_geom%22)%20%2B%201)%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-35.947265625%2C19.89072302399691%2C-20.302734375%2C33.797408767572485%2C%204326)%2C%207.3333740234375)%2C0.0611114501953125)%2C%200.0611114501953125)%20ELSE%20ST_CollectionExtract(ST_MakeValid(ST_Snap(ST_CollectionExtract(ST_SnapToGrid(ST_CollectionExtract(ST_Simplify(%22the_geom%22%2C%200.03055572509765625)%2C%20ST_Dimension(%22the_geom%22)%20%2B%201)%2C%200.0611114501953125)%2C%20ST_Dimension(%22the_geom%22)%20%2B%201)%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-35.947265625%2C19.89072302399691%2C-20.302734375%2C33.797408767572485%2C%204326)%2C%207.3333740234375)%2C0.0611114501953125)%2C%200.0611114501953125))%2C%20ST_Dimension(%22the_geom%22)%20%2B%201)%20END%2C%20ST_SnapToGrid(ST_Expand(ST_MakeEnvelope(-35.947265625%2C19.89072302399691%2C-20.302734375%2C33.797408767572485%2C%204326)%2C%207.3333740234375)%2C0.0611114501953125))%20as%20the_geom%2Cpop_max%20%20FROM%20populated_places%20WHERE%20the_geom%20%26%26%20ST_MakeEnvelope(-35.947265625%2C19.89072302399691%2C-20.302734375%2C33.797408767572485%2C%204326) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment