Created
April 18, 2016 10:55
-
-
Save tuttinator/a64a928276afb99ac761de8a8716e9d6 to your computer and use it in GitHub Desktop.
Turn a bbox string into an EWKT polygon
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
| def polygon_from_bbox(str) | |
| south_west_lat, south_west_lng, north_east_lat, north_east_lng = str.split(',') | |
| "SRID=4326;POLYGON((" + | |
| south_west_lat + " " + south_west_lng + "," + | |
| north_east_lat + " " + south_west_lng + "," + | |
| north_east_lat + " " + north_east_lng + "," + | |
| south_west_lat + " " + north_east_lng + "," + | |
| south_west_lat + " " + south_west_lng + "))" | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment