<jupyter_start><jupyter_text>How to use the WFSGeojsonLayer class This class provides WFS layers for ipyleaflet from services than avec geojson output capabilities We first have to create the WFS connection and instanciate the map:<jupyter_code>from birdy import IpyleafletWFS
from ipyleaflet import Map

url = 'http://boreas.ouranos.ca/geoserver/wfs'
version = '2.0.0'

wfs_connection = IpyleafletWFS(url, version)

demo_map = Map(center=(46.42, -64.14), zoom=8)
demo_map<jupyter_output><empty_output><jupyter_text>We can then retrieve the available layers. We will use these to create our WFS layer.<jupyter_code>wfs_connection.layer_list<jupyter_output><empty_output><jupyter_text>Next we create our WFS layer from one of the layers listed above. It is filtered by the extent of the map, seen above. This next function is a builder and will create, add and configure the map with it's two default widgets.<jupyter_code>wfs_connection.build_layer(layer_typename='public:HydroLAKES_poly', source_map=demo_map)<jupyter_output><empty_output><jupyter_text>The layer created above will have a refresh button, which can be pressed to refresh the WFS layer. It will also have a property widget in the lower right corner of the map, and will show the feature ID of a feature after you click on it. It's also possible to add a new property widget. We first need to retrieve the properties of a feature. The following code returns the properties of the first feature, which should be shared by all features.<jupyter_code>wfs_connection.property_list<jupyter_output><empty_output><jupyter_text>We can create a new widget from any of the above properties The widget_name parameter needs to be unique, else it will overwrite the existing one.<jupyter_code>wfs_connection.create_feature_property_widget(widget_name='Wshd_area', feature_property='Wshd_area', widget_position='bottomleft')
demo_map<jupyter_output><empty_output><jupyter_text>To replace the default property widget, the same function can be used with the 'main_widget' name. This can be usefull when there is no need for the feature ID, or on the off chance that the first property attribute does not contain the feature ID.<jupyter_code>wfs_connection.create_feature_property_widget(widget_name='main_widget', feature_property='Lake_area')<jupyter_output><empty_output><jupyter_text>The geojson data is available. The results are also filtered by what is visible on the map.<jupyter_code>gjson = wfs_connection.geojson
gjson['features'][0].keys()

gjson['totalFeatures']<jupyter_output><empty_output><jupyter_text>A search by ID for features is also available. Let's set back the main widget to default so we can have access to feature IDs again<jupyter_code>wfs_connection.create_feature_property_widget(widget_name='main_widget')
demo_map<jupyter_output><empty_output><jupyter_text>Now click on a feature and replace '748' in the cell below with a new ID number to get the full properties of that feature<jupyter_code>wfs_connection.feature_properties_by_id(748)<jupyter_output><empty_output><jupyter_text>To get rid of all the property widgets:<jupyter_code>wfs_connection.clear_property_widgets()
demo_map
### And finally, to remove the layer from the map
wfs_connection.remove_layer()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06570904645476773, 'fraction_numerical': 0.005806845965770171, 'mean_word_length': 7.203007518796992, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 41, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '568989', 'license': 'Apache-2.0', 'n_tokens_mistral': 991, 'n_tokens_neox': 974, 'n_words': 351, 'path': 'birdy/ipyleafletwfs/examples/ipyleafletwfs_guide.ipynb', 'repo_name': 'f-PLT/birdy', 'size': '3272'}