-
-
Save soiqualang/e16753544ee822c0257321fc6cd2b8f4 to your computer and use it in GitHub Desktop.
mass download vector data from WFS service. Generates a sh script with ogr2ogr calls.
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
from owslib.fes import * | |
from owslib.etree import etree | |
from owslib.wfs import WebFeatureService | |
wfs11 = WebFeatureService(url='http://example.com:8080/geoserver/wfs/', version='1.1.0') | |
f = open('download.sh', 'wb') | |
f.write('#!/bin/bash'+'\n') | |
f.write(''+'\n') | |
for layername in wfs11.contents: | |
if 'namepart'.lower() in layername.lower(): | |
cmd='ogr2ogr -progress -f "GeoJSON" {}.geojson WFS:"http://example.com:8080/geoserver/wfs" {}'.format(layername, layername) | |
print cmd | |
f.write(cmd+'\n') | |
f.close |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment