Created
September 2, 2016 00:23
-
-
Save Synesso/96b216d7400581b9812005e0bc6fd2fc to your computer and use it in GitHub Desktop.
split-bbox-for-regions.json
This file contains 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
val gc = Bounds(Point(-28.223163, 153.372282), Point(-27.854310, 153.493241)) | |
def loop(bb: Bounds): List[Bounds] = { | |
if (Distance(bb.sw, bb.ne).miles > 15) { | |
val (a,b,c,d) = bb.quadrants | |
List(a,b,c,d).flatMap(loop) | |
} else List(bb) | |
} | |
def toJson(bb: Bounds): String = { | |
s"""{"minLng": ${bb.sw.lon}, "minLat": ${bb.sw.lat}, "maxLng": ${bb.ne.lon}, "maxLat": ${bb.ne.lat}}""" | |
} | |
println(s""""bboxes": [${loop(gc).map(toJson).mkString(",\n")}]""") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment