def raster(): return geofu.load(os.path.join(DATA, "slope.tif"))
def lines(): return geofu.load(os.path.join(DATA, "lines.shp"))
def polygons(): return geofu.load(os.path.join(DATA, "polygons.shp"))
def points(): return geofu.load(os.path.join(DATA, "points.shp"))
def points_noproj(): return geofu.load(os.path.join(DATA, "points_noproj.shp"))
def test_load_nonexistent(): DATA = os.path.join(os.path.dirname(os.path.abspath(__file__)), "data") with pytest.raises(IOError): d = geofu.load(os.path.join(DATA, "THISFILEDOESNOTEXISTANYWHERE.shp"))
from geofu import load d1 = load("test_data/union_test/states.shp") d2 = load("test_data/testname_buffer.shp") d12 = d1.intersection(d2) d12.render_png(show=True) print d12 d12 = d1.identity(d2) d12.render_png(show=True) print d12 d12 = d1.union(d2) d12.render_png(show=True) print d12
import geofu pts = geofu.load("test_data/at_shelters.shp") # what's out coordinate reference system print pts.crs # reproject to US National Atlas #pts = pts.reproject(2163) ptbuff = pts.buffer(0.4) print ptbuff import sys sys.exit() # buffer by 5km ptbuff = pts.buffer(5000) # use the mapfart.com web service to render it ptbuff.mapfart(show=True) # Get it as a fiona collection print type(ptbuff.collection()) # let's examine the geojson string print ptbuff.geojson(indent=2)[:200] # And use geojsonlint.com to validate it print "Is this geojson valid?", ptbuff.validate_geojson()
from geofu import load print load("../test_data/at_shelters.shp")\ .reproject(2163).buffer(21000).reproject(4326)\ .save("../test_data/woot.shp")\ .render_png(show=True)
import geofu d = geofu.load("test_data/states.shp") #d = d.reproject(2163) d = d.simplify(0.1) print d.render_png(show=True)