@@ -87,38 +87,27 @@ L.tileLayer('https://tiles.oklabflensburg.de/sgm/{z}/{x}/{y}.png', {
8787 attribution : '© <a href="https://www.openstreetmap.org/copyright" target="_blank" rel="dc:rights">OpenStreetMap</a> contributors'
8888} ) . addTo ( map )
8989
90- let geocoder = L . Control . Geocoder . nominatim ( )
91- let previousSelectedMarker = null
92- let dataObject = null
93- let cluster = null
94-
95-
96- if ( typeof URLSearchParams !== 'undefined' && location . search ) {
97- // parse /?geocoder=nominatim from URL
98- const params = new URLSearchParams ( location . search )
99- const geocoderString = params . get ( 'geocoder' )
100-
101- if ( geocoderString && L . Control . Geocoder [ geocoderString ] ) {
102- console . log ( 'Using geocoder' , geocoderString )
103- geocoder = L . Control . Geocoder [ geocoderString ] ( )
104- }
105- else if ( geocoderString ) {
106- console . warn ( 'Unsupported geocoder' , geocoderString )
107- }
108- }
90+ const geocoder = L . Control . Geocoder . nominatim ( {
91+ serviceUrl : 'https://nominatim.oklabflensburg.de/'
92+ } )
10993
110- const osmGeocoder = new L . Control . geocoder ( {
111- query : 'Flensburg' ,
94+ const control = L . Control . geocoder ( {
95+ geocoder ,
11296 position : 'topright' ,
11397 placeholder : 'Adresse oder Ort' ,
11498 defaultMarkGeocode : false
11599} ) . addTo ( map )
116100
117- osmGeocoder . on ( 'markgeocode' , ( e ) => {
101+ control . on ( 'markgeocode' , ( e ) => {
118102 const bounds = L . latLngBounds ( e . geocode . bbox . _southWest , e . geocode . bbox . _northEast )
119103 map . fitBounds ( bounds )
120104} )
121105
106+ let previousSelectedMarker = null
107+ let dataObject = null
108+ let cluster = null
109+
110+
122111function addDistrictsLayer ( data ) {
123112 L . geoJson ( data , {
124113 style : layerStyle . standard
0 commit comments