The two methods should return the same result, but only the manual method is returning points in the (lon,lat) order requested by srsName=EPSG:4326
. The OWSLib version results are still coming back with
the default 1.1.0 order (lat,lon), indicating that srsName=EPSG:4326
was not passed to the WFS
In [30]:
# some USGS ScienceBase Geoserver WFS endpoints:
endpoint='https://www.sciencebase.gov/catalogMaps/mapping/ows/5342c5fce4b0aa151574a8ed'
In [ ]:
import requests
import geojson
In [38]:
url = ('%s?service=wfs&version=1.1.0&request=GetFeature&'
'typeNames=%s&srsName=EPSG:4326&outputFormat=application/json') % (endpoint, 'sb:Conservation_Zone_WGS84')
print url
In [ ]:
json_response=requests.get(url).text
Here we get [lon,lat]
ordering of points, as requested by using srsName=EPSG:4326
In [39]:
print json_response[:300]
In [42]:
from owslib.wfs import WebFeatureService
In [43]:
wfs = WebFeatureService(endpoint, version='1.1.0')
print wfs.version
In [44]:
json_response = wfs.getfeature(typename=['sb:Conservation_Zone_WGS84'], propertyname=None, srsname='EPSG:4326', outputFormat='application/json').read()
Here we get still getting [lat,lon]
ordering of points, the default if no srsName
is provided, despite requesting srsname='EPSG:4326'
In [45]:
json_response[:300]
Out[45]:
In [ ]: