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
import re | |
import requests | |
import json | |
import urlparse | |
from sys import stderr | |
def connect(url): | |
""" Extract source from passed URL. """ | |
headers = {"User-Agent": "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:30.0)"\ |
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
# Convert between geojson and sp spatial objects in R | |
require(rgdal) | |
# https://stat.duke.edu/~cr173/Sta523_Fa14/spatial_data.html | |
s <- '{ "type": "MultiPolygon", "coordinates": [ | |
[ [[40, 40], [20, 45], [45, 30], [40, 40]] ], | |
[ [[20, 35], [10, 30], [10, 10], [30, 5], [45, 20], [20, 35]], | |
[[30, 20], [20, 15], [20, 25], [30, 20]] | |
] | |
]}' |