@@ -161,12 +161,61 @@ <h2 class="nhsuk-heading-m">BSO area</h2>
161161 < script src ="https://unpkg.com/maplibre-gl@5.3.0/dist/maplibre-gl.js "> </ script >
162162 < script src ="https://unpkg.com/@maplibre/maplibre-gl-leaflet@0.1.0/leaflet-maplibre-gl.js "> </ script >
163163
164- < script src ="/assets/javascript/map-scripts.js "> </ script >
164+ < script >
165+ function circleIcon ( { fill = '#fff' , stroke = '#000' , strokeWidth = 2 ,
166+ text = '' , textColor = '#000' , radius = 14 , fillOpacity = 1 } = { } ) {
167+ const width = radius * 2 ;
168+ const pointHeight = radius * 1.2 ;
169+ const height = width + pointHeight ;
170+ const cx = radius ;
171+ const cy = radius ;
172+
173+ return L . divIcon ( {
174+ html : `<svg viewBox="0 0 ${ width } ${ height } " width="${ width } " height="${ height } " xmlns="http://www.w3.org/2000/svg">
175+ <!-- Stroke-only pin line -->
176+ <line
177+ x1="${ cx } " y1="${ cy + radius - strokeWidth } "
178+ x2="${ cx } " y2="${ height - strokeWidth } "
179+ stroke="${ stroke } " stroke-width="${ strokeWidth } "/>
180+ <!-- Filled circle on top -->
181+ <circle
182+ cx="${ cx } " cy="${ cy } " r="${ radius - strokeWidth } "
183+ fill="${ fill } " fill-opacity="${ fillOpacity } " stroke="${ stroke } " stroke-width="${ strokeWidth } "/>
184+ <!-- Text -->
185+ <text x="${ cx } " y="${ cy } " text-anchor="middle" dominant-baseline="central"
186+ fill="${ textColor } " font-size="${ radius * 0.9 } " font-family="sans-serif" font-weight="bold">
187+ ${ text }
188+ </text>
189+ </svg>` ,
190+ className : '' ,
191+ iconSize : [ width , height ] ,
192+ iconAnchor : [ cx , height ] ,
193+ popupAnchor : [ 0 , - height ]
194+ } ) ;
195+ }
196+
197+ const landmarkIcons = {
198+ orgLocation : circleIcon ( { fill : '#fff9c4' , text : 'O' } ) ,
199+ static : circleIcon ( { fill : '#fff9c4' , text : 'S' } ) ,
200+ mobile : circleIcon ( { fill : '#ed8b00' , text : 'M' } ) ,
201+ default : circleIcon ( { fill : '#fff' , text : '' } ) ,
202+ } ;
203+
204+ const mapOptions = {
205+ attributionControl : false ,
206+ scrollWheelZoom : false
207+ } ;
208+
209+ const map = L . map ( 'app-map' , {
210+ maxZoom : 15
211+ } ) ;
212+ </ script >
213+
165214 < script src ="geo-bso-west-berks.js "> </ script >
166215
167216 < script >
168217
169- const apiKey = 't9ErutMVGdziLrLqJbCM049xw5550C0e ' ;
218+ const apiKey = 'lWF9hAvJ3ALTasfGgV8MqmfAWJ2L9fhU ' ;
170219
171220 landmarks . forEach ( ( { lat, lng, type, name } ) => {
172221 const icon = landmarkIcons [ type ] || landmarkIcons . default ;
0 commit comments