-
Glenn Vorhes authoredGlenn Vorhes authored
Code owners
Assign users and groups as approvers for specific file changes. Learn more.
geocode.js.map 6.84 KiB
{"version":3,"file":"geocode.js","sourceRoot":"","sources":["../../src/olHelpers/geocode.ts"],"names":[],"mappings":";;AAAA,0BAA4B;AAC5B,6CAA0C;AAC1C,8BAAiC;AACjC,6CAAiD;AAGjD,IAAI,YAAY,GAAG,kBAAkB,CAAC;AACtC,IAAI,oBAAoB,GAAG,kBAAkB,CAAC;AAE9C,yDAAyD;AAGzD;IAMI,iBAAY,MAAsB,EAAE,GAAW;QAA/C,iBA4EC;QA3EG,IAAI,SAAS,GAAG,mBAAQ,EAAE,CAAC;QAC3B,IAAI,UAAU,GAAG,mBAAQ,EAAE,CAAC;QAE5B,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;QACf,IAAI,CAAC,eAAe,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;YACvC,MAAM,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE;YAC9B,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;gBACtB,KAAK,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC;oBACvB,MAAM,EAAE,EAAE;oBACV,IAAI,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,KAAK,EAAE,mBAAmB,EAAC,CAAC;oBACrD,MAAM,EAAE,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAC,CAAC;iBACxD,CAAC;aACL,CAAC;SACL,CAAC,CAAC;QACH,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAExC,CAAC,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,2BAA2B;aACxC,+BAA0B,SAAS,QAAI,CAAA;aACvC,kBAAe,UAAU,uBAAmB,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AAI,CAAC,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAC;IAC7B,CAAC;IAQL,cAAC;AAAD,CAAC,AA/FD,IA+FC;AA/FY,0BAAO","sourcesContent":["import $ = require('jquery')\r\nimport {makeGuid} from '../util/makeGuid';\r\nimport ol = require('custom-ol');\r\nimport {proj3857, proj4326} from './projections';\r\n\r\n\r\nlet invalidClass = 'geocoder-invalid';\r\nlet geocoderLoadingClass = 'geocoder-loading';\r\n\r\n// let testAddress = '65 7th Street, Prairie du Sac, WI';\r\n\r\n\r\nexport class Geocode {\r\n private theButton: HTMLButtonElement;\r\n private theInput: HTMLInputElement;\r\n private map: ol.Map;\r\n private indicationLayer;\r\n\r\n constructor(mapDiv: HTMLDivElement, map: ol.Map) {\r\n let inputGuid = makeGuid();\r\n let buttonGuid = makeGuid();\r\n\r\n this.map = map;\r\n this.indicationLayer = new ol.layer.Vector({\r\n source: new ol.source.Vector(),\r\n style: new ol.style.Style({\r\n image: new ol.style.Circle({\r\n radius: 12,\r\n fill: new ol.style.Fill({color: 'rgba(255,0,0,0.5)'}),\r\n stroke: new ol.style.Stroke({color: 'red', width: 1})\r\n })\r\n })\r\n });\r\n this.map.addLayer(this.indicationLayer);\r\n\r\n $(mapDiv).append('<div class=\"geocoder-el\">' +\r\n `<input type=\"text\" id=\"${inputGuid}\">` +\r\n `<button id=\"${buttonGuid}\">Search</button>` +\r\n '</div>');\r\n\r\n this.theButton = document.getElementById(buttonGuid) as HTMLButtonElement;\r\n this.theInput = document.getElementById(inputGuid) as HTMLInputElement;\r\n\r\n this.reset();\r\n\r\n let $theButton = $(this.theButton);\r\n let $theInput = $(this.theInput);\r\n\r\n $theButton.click(() => {\r\n\r\n $theButton.addClass(geocoderLoadingClass);\r\n this.theButton.disabled = true;\r\n this.indicationLayer.getSource().clear();\r\n\r\n $.get(\r\n `https://geocode.xyz/${this.theInput.value}?geoit=json`,\r\n {},\r\n (d) => {\r\n let lat = parseFloat(d['latt']);\r\n let lon = parseFloat(d['longt']);\r\n\r\n if ((lat == 0 && lon == 0) || d['error']) {\r\n $theInput.addClass(invalidClass);\r\n this.theInput.title = 'Specified Location Invalid';\r\n this.theButton.title = 'Specified Location Invalid';\r\n\r\n } else {\r\n let v = this.map.getView();\r\n let p = new ol.geom.Point([lon, lat]);\r\n let feat = new ol.Feature(p);\r\n this.indicationLayer.getSource().addFeature(feat);\r\n p.transform(proj4326, proj3857);\r\n\r\n v.setCenter(p.getCoordinates());\r\n v.setZoom(13);\r\n }\r\n\r\n $theButton.removeClass(geocoderLoadingClass);\r\n this.theButton.disabled = false;\r\n },\r\n 'json');\r\n });\r\n\r\n $(this.theInput).keyup((evt) => {\r\n this.theButton.disabled = this.theInput.value.length == 0;\r\n $theInput.removeClass(invalidClass);\r\n this.theInput.title = '';\r\n this.theButton.title = '';\r\n\r\n if (!this.theButton.disabled && evt.keyCode == 13) {\r\n $theButton.click();\r\n }\r\n })\r\n\r\n }\r\n\r\n private reset() {\r\n this.theButton.disabled = true;\r\n this.theInput.value = '';\r\n }\r\n\r\n\r\n// https://geocode.xyz/65%2075h%20street%20prairie%20du%20sac%20wi?geoit=json\r\n\r\n// error\r\n// geocoder-invalid\r\n\r\n}\r\n\r\n\r\n\r\n"]}