aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/dumbymap.mjs
diff options
context:
space:
mode:
Diffstat (limited to 'src/dumbymap.mjs')
-rw-r--r--src/dumbymap.mjs9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/dumbymap.mjs b/src/dumbymap.mjs
index 6602f29..974d4a3 100644
--- a/src/dumbymap.mjs
+++ b/src/dumbymap.mjs
@@ -179,7 +179,7 @@ export const generateMaps = (container, {
179 179
180 /** Set CRS and GeoLinks */ 180 /** Set CRS and GeoLinks */
181 register(proj4) 181 register(proj4)
182 fromEPSGCode(crs).then(() => { 182 fromEPSGCode(crs).then(projection => {
183 const transform = proj4(crs, 'EPSG:4326').forward 183 const transform = proj4(crs, 'EPSG:4326').forward
184 184
185 Array.from(container.querySelectorAll(geoLinkSelector)) 185 Array.from(container.querySelectorAll(geoLinkSelector))
@@ -200,6 +200,13 @@ export const generateMaps = (container, {
200 params.set('q', `${lat},${lon}`) 200 params.set('q', `${lat},${lon}`)
201 link.search = params 201 link.search = params
202 202
203 if (projection.getUnits() === 'degrees' &&
204 (lon > 180 || lon < -180 || lat > 90 || lat < -90)
205 ) {
206 link.dataset.valid = false
207 link.title = `Invalid Coordinate, maybe try another crs other than ${crs}`
208 }
209
203 return link 210 return link
204 }) 211 })
205 .forEach(utils.createGeoLink) 212 .forEach(utils.createGeoLink)