Initial commit
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
from .wfs import *
|
||||
Binary file not shown.
Binary file not shown.
+24
@@ -0,0 +1,24 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: UTF-8 -*-
|
||||
|
||||
from owslib.wfs import WebFeatureService
|
||||
|
||||
def get_wfs(url, layer, bbox=None):
|
||||
from geopandas import read_file
|
||||
from requests import Request
|
||||
wfs = WebFeatureService(url=url)
|
||||
item = dict(wfs.items())[layer]
|
||||
crs = item.crsOptions[0].getcode()
|
||||
params = dict(service='WFS', version=wfs.version, request='GetFeature',
|
||||
typeName=layer)
|
||||
q = Request('GET', url, params=params).prepare().url
|
||||
data = read_file(q, bbox=bbox)
|
||||
data.set_crs(crs=crs, inplace=True)
|
||||
if crs != 'EPSG:2154':
|
||||
data.to_crs(epsg=2154, inplace=True)
|
||||
return data
|
||||
|
||||
def list_layer(url):
|
||||
wfs = WebFeatureService(url=url)
|
||||
lst = list(wfs.contents)
|
||||
return lst
|
||||
Reference in New Issue
Block a user