You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the Leaflet code, it looks like an ampersand is missing at the end of line 20, which reads:
"version=1.1.0&request=GetFeature&typename=druid:cj149vc4113" +
but should be:
"version=1.1.0&request=GetFeature&typename=druid:cj149vc4113&" +
In the Python code, we should include the imports in the code, even when we note that the installs are necessary in the comment:
import requests
import geopandas as gpd
import folium
See correct python code below
Before running this code, install or check for these libraries
!pip install geopandas folium
import requests
import geopandas as gpd
import folium
Accept user input for the GeoServer URL and the typeName of the layer
Comments:
In the Leaflet code, it looks like an ampersand is missing at the end of line 20, which reads:
"version=1.1.0&request=GetFeature&typename=druid:cj149vc4113" +
but should be:
"version=1.1.0&request=GetFeature&typename=druid:cj149vc4113&" +
In the Python code, we should include the imports in the code, even when we note that the installs are necessary in the comment:
import requests
import geopandas as gpd
import folium
See correct python code below
Before running this code, install or check for these libraries
!pip install geopandas folium
import requests
import geopandas as gpd
import folium
Accept user input for the GeoServer URL and the typeName of the layer
geoserver_url = "https://geowebservices.stanford.edu/geoserver/wfs?"
type_name = "druid:mf519gg2738"
Define the parameters for the WFS service
params = {
'service': 'WFS',
'version': '2.0.0',
'request': 'GetFeature',
'typeName': type_name,
'outputFormat': 'application/json'
}
Send a GET request to the GeoServer WFS service
response = requests.get(geoserver_url, params=params)
Load the features from the WFS service into a GeoDataFrame
gdf = gpd.read_file(response.text)
Get the bounds of the GeoDataFrame
bounds = gdf.total_bounds
Calculate the center of the bounds
center = [(bounds[1] + bounds[3]) / 2, (bounds[0] + bounds[2]) / 2]
Create the map
m = folium.Map(location=center, zoom_start=2)
Add the GeoDataFrame to the map as a GeoJson layer
folium.GeoJson(gdf).add_to(m)
Display the map
m
The text was updated successfully, but these errors were encountered: