@sk-global/js-msearch-gsi-jp 1.1.13 → 1.1.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.module.js +1 -1
- package/dist/index.module.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/e(require("axios")),t=/GSI\.MUNI_ARRAY\["\d+"\]\s*=\s*'(.*?)';/g,n=function(){try{return Promise.resolve(r.default.get("https://maps.gsi.go.jp/js/muni.js",{responseType:"text"})).then(function(e){return function(e){var r={};return e.split("\n").forEach(function(e){if(t.test(e)){var n=function(e){var r=e.replace(t,"$1"),n=r.split(",");if(4!==n.length)throw new Error("invalid muni record: "+r);var o=n[0],s=n[1],i=n[2],u=n[3];return i=i.padStart(5,"0"),{prefCode:o=o.padStart(2,"0"),prefName:s,cityCode:i,cityName:u}}(e);r[n.cityCode]=n}}),r}(e.data)})}catch(e){return Promise.reject(e)}},o=null,s=function(e,t){try{return Promise.resolve(function(n,o){try{var s=Promise.resolve(r.default.get("https://mreversegeocoder.gsi.go.jp/reverse-geocoder/LonLatToAddress",{timeout:
|
|
1
|
+
function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=/*#__PURE__*/e(require("axios")),t=/GSI\.MUNI_ARRAY\["\d+"\]\s*=\s*'(.*?)';/g,n=function(){try{return Promise.resolve(r.default.get("https://maps.gsi.go.jp/js/muni.js",{responseType:"text"})).then(function(e){return function(e){var r={};return e.split("\n").forEach(function(e){if(t.test(e)){var n=function(e){var r=e.replace(t,"$1"),n=r.split(",");if(4!==n.length)throw new Error("invalid muni record: "+r);var o=n[0],s=n[1],i=n[2],u=n[3];return i=i.padStart(5,"0"),{prefCode:o=o.padStart(2,"0"),prefName:s,cityCode:i,cityName:u}}(e);r[n.cityCode]=n}}),r}(e.data)})}catch(e){return Promise.reject(e)}},o=null,s=function(e,t){try{return Promise.resolve(function(n,o){try{var s=Promise.resolve(r.default.get("https://mreversegeocoder.gsi.go.jp/reverse-geocoder/LonLatToAddress",{timeout:500,responseType:"json",params:{lat:e,lon:t}})).then(function(e){if(200!==e.status){console.log("response");var r=new Error("Failed to get address. status is not 200");throw r.name="API_ERROR",r}return e.data})}catch(e){return o(e)}return s&&s.then?s.then(void 0,o):s}(0,function(e){if(e.response){console.log("error.response");var r=new Error("Failed to get address. status is not 200");throw r.name="API_ERROR",r}throw console.log("error"),e}))}catch(e){return Promise.reject(e)}};exports.getMuniMap=n,exports.latLonToAddress=s,exports.latLonToAddressInfo=function(e,r){return Promise.resolve(s(e,r)).then(function(e){function r(){return o[t.muniCd]}var t=e.results;if(!t||!t.muniCd)throw new Error("No address found");var s=function(){if(!o)return console.log("getMuniMap"),Promise.resolve(n()).then(function(e){o=e})}();return s&&s.then?s.then(r):r()})},exports.latLonToAddressName=function(e,r){return Promise.resolve(s(e,r)).then(function(e){function r(){return function(e,r){var t=function(e,r){var t=e[r];if(!t)throw new Error("muni code "+r+" not found");return(""+t.prefName+t.cityName).replace(/ /g,"")}(e,r.muniCd);return""+t+r.lv01Nm}(o,t)}var t=e.results;if(!t||!t.muniCd)throw new Error("No address found");var s=function(){if(!o)return Promise.resolve(n()).then(function(e){o=e})}();return s&&s.then?s.then(r):r()})},exports.searchAddress=function(e){try{return Promise.resolve(r.default.get("https://msearch.gsi.go.jp/address-search/AddressSearch",{responseType:"json",params:{q:e}})).then(function(e){return e.data})}catch(e){return Promise.reject(e)}};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../src/muni.ts","../src/m_reverse_geocode.ts","../src/msearch.ts"],"sourcesContent":["// Muni file url\nconst MuniURL = 'https://maps.gsi.go.jp/js/muni.js';\nconst MuniRegex = /GSI\\.MUNI_ARRAY\\[\"\\d+\"\\]\\s*=\\s*'(.*?)';/g;\n\nimport axios from 'axios';\nimport { AddressResults, MuniMap } from './types';\n\n/**\n * parse muni.js\n * @param muniMap\n */\nconst parseMuniMap = (muniMap: string) => {\n const muniMapObj: MuniMap = {};\n const lines = muniMap.split('\\n');\n lines.forEach((line) => {\n if (MuniRegex.test(line)) {\n const muniRecord = parseMuniRecord(line);\n muniMapObj[muniRecord.cityCode] = muniRecord;\n }\n });\n return muniMapObj;\n};\n\n/**\n * parse muni record\n * @param line\n */\nconst parseMuniRecord = (line: string) => {\n const muniRecord = line.replace(MuniRegex, '$1');\n\n const muniRecordArray = muniRecord.split(',');\n\n // validate muni record\n if (muniRecordArray.length !== 4) {\n throw new Error(`invalid muni record: ${muniRecord}`);\n }\n\n let [prefCode, prefName, cityCode, cityName] = muniRecordArray;\n\n // if cityCode is not 5 digits, add 0 to the beginning\n cityCode = cityCode.padStart(5, '0');\n\n // if prefCode is not 2 digits, add 0 to the beginning\n prefCode = prefCode.padStart(2, '0');\n\n return {\n prefCode: prefCode,\n prefName: prefName,\n cityCode: cityCode,\n cityName: cityName,\n };\n};\n\n/**\n * Get muni map (city or ward map by city code) from GSI\n */\nconst getMuniMap = async () => {\n const response = await axios.get(MuniURL, {\n responseType: 'text',\n });\n\n const muniMap = response.data;\n return parseMuniMap(muniMap);\n};\n\n/**\n * converts muni code to address name.\n *\n * @param muniMap\n * @param muniCode\n */\nconst muniCodeToAddressName = (muniMap: MuniMap, muniCode: string) => {\n const muniRecord = muniMap[muniCode];\n if (!muniRecord) {\n throw new Error(`muni code ${muniCode} not found`);\n }\n\n const add = `${muniRecord.prefName}${muniRecord.cityName}`;\n return add.replace(/ /g, '');\n};\n\n/**\n * converts address result to address name.\n * @param muniMap\n * @param addressResults\n */\nconst addressResultsToAddressName = (\n muniMap: MuniMap,\n addressResults: AddressResults\n) => {\n const mc = addressResults.muniCd;\n const muniName = muniCodeToAddressName(muniMap, mc);\n const addrName = `${muniName}${addressResults.lv01Nm}`;\n return addrName;\n};\n\nconst getMuniMapLocations = async () => {\n const muniMap = await getMuniMap();\n // muniMap is a map of all cities and wards in Japan\n // key: city code, value: { prefCode, prefName, cityCode, cityName }\n // we need to convert this to a map of all locations in Japan\n // key: prefCode , value: { prefName, cities: { key: cityCode, value: { cityCode, cityName, wards: { key: wardCode, value: { wardCode, wardName } } } } }\n\n const muniMapLocations = {};\n Object.keys(muniMap).forEach((cityCode) => {\n const muniRecord = muniMap[cityCode];\n const { prefCode, prefName, cityName } = muniRecord;\n if (!muniMapLocations[prefCode]) {\n muniMapLocations[prefCode] = { prefName, cities: {} };\n }\n\n // if cityName contains ' ', it is a ward\n // otherwise, it is a city\n if (cityName.includes(' ')) {\n // ward name is after ' '\n const [name, wardName] = cityName.split(' ');\n // find city has the same name\n const city: any = Object.values(muniMap).find(\n (c: any) => c.cityName === name\n );\n if (!city) {\n console.log(`City ${name} not found in prefCode ${prefCode}`);\n } else {\n // add ward to city\n muniMapLocations[prefCode].cities[city.cityCode].wards[cityCode] = {\n prefCode,\n cityCode: cityCode,\n cityName: `${name}${wardName}`,\n bigCityFlag: '1',\n bigCityCode: city.cityCode,\n };\n }\n } else {\n muniMapLocations[prefCode].cities[cityCode] = {\n prefCode,\n cityCode,\n cityName,\n wards: {},\n };\n }\n });\n\n // assign bigCityFlag to each city\n Object.keys(muniMapLocations).forEach((prefCode) => {\n const pref = muniMapLocations[prefCode];\n Object.keys(pref.cities).forEach((cityCode) => {\n const city = pref.cities[cityCode];\n const isBigCity = Object.values(city.wards).length > 0;\n if (isBigCity) {\n city.bigCityFlag = '2';\n } else {\n // delete wards\n delete city.wards;\n // if city is tokyo then bigCityFlag is 3, otherwise 0\n if (city.prefCode === '13') {\n city.bigCityFlag = '3';\n } else {\n city.bigCityFlag = '0';\n }\n }\n });\n });\n\n return muniMapLocations;\n};\n\nexport {\n getMuniMap,\n getMuniMapLocations,\n muniCodeToAddressName,\n addressResultsToAddressName,\n};\n","import axios from 'axios';\n\nimport { ReverseGeocodeResults, MuniMap, MuniRecord } from './types';\nimport { addressResultsToAddressName, getMuniMap } from './muni';\nconst BaseURL = 'https://mreversegeocoder.gsi.go.jp';\n\n// cache muni map\nvar muniMap: MuniMap | null = null;\n\n/**\n * reverse geocoding by latitude and longitude to address\n * It returns town name only\n *\n * @param lat\n * @param lon\n * @returns address\n */\nconst latLonToAddress = async (\n lat: number,\n lon: number\n): Promise<ReverseGeocodeResults> => {\n try {\n const url = `${BaseURL}/reverse-geocoder/LonLatToAddress`;\n const response = await axios.get(url, {\n timeout: 5000, // Timeout after 5 seconds\n responseType: 'json',\n params: {\n lat,\n lon,\n },\n });\n\n // if status is not 200\n if (response.status !== 200) {\n console.log(\"response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n }\n\n const res = response.data;\n return res;\n } catch (error: any) {\n // if it is axios error\n if (error.response) {\n console.log(\"error.response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n } else {\n console.log(\"error\");\n throw error;\n }\n }\n};\n\n/**\n * Get full address name by latitude and longitude\n * @param lat\n * @param lon\n * @returns prefecture + city + town\n */\nconst latLonToAddressName = async (\n lat: number,\n lon: number\n): Promise<string> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n muniMap = await getMuniMap();\n }\n\n return addressResultsToAddressName(muniMap, results);\n};\n\nconst latLonToAddressInfo = async (\n lat: number,\n lon: number\n): Promise<MuniRecord> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n console.log('getMuniMap');\n muniMap = await getMuniMap();\n }\n const mc = results.muniCd;\n return muniMap[mc];\n};\n\nexport {\n latLonToAddressInfo,\n getMuniMap,\n latLonToAddress,\n latLonToAddressName,\n};\n","import axios from 'axios';\n\nimport { SearchResults } from './types';\n\n// base url for msearch api\nconst BaseURL = 'https://msearch.gsi.go.jp';\n\n/**\n * search address by query\n */\nconst searchAddress = async (q: string): Promise<SearchResults> => {\n const url = `${BaseURL}/address-search/AddressSearch`;\n const response = await axios.get(url, {\n responseType: 'json',\n params: {\n q,\n },\n });\n\n const res = response.data;\n return res;\n};\n\nexport { searchAddress };\n"],"names":["MuniRegex","getMuniMap","Promise","resolve","axios","get","responseType","then","response","muniMap","muniMapObj","split","forEach","line","test","muniRecord","replace","muniRecordArray","length","Error","prefCode","prefName","cityCode","cityName","padStart","parseMuniRecord","parseMuniMap","data","e","reject","latLonToAddress","lat","lon","BaseURL","timeout","params","status","console","log","err","name","_catch","error","res","_temp4","results","muniCd","_temp3","_getMuniMap2","_temp2","addressResults","muniName","muniCode","muniCodeToAddressName","lv01Nm","addressResultsToAddressName","_temp","_getMuniMap","q"],"mappings":"+GAEMA,EAAY,2CAsDZC,EAAU,eAAcC,OAAAA,QAAAC,QACLC,UAAMC,IAxDf,oCAwD4B,CACxCC,aAAc,UACdC,cAFIC,GAKN,OAnDmB,SAACC,GACpB,IAAMC,EAAsB,CAAA,EAQ5B,OAPcD,EAAQE,MAAM,MACtBC,QAAQ,SAACC,GACb,GAAIb,EAAUc,KAAKD,GAAO,CACxB,IAAME,EAWY,SAACF,GACvB,IAAME,EAAaF,EAAKG,QAAQhB,EAAW,MAErCiB,EAAkBF,EAAWJ,MAAM,KAGzC,GAA+B,IAA3BM,EAAgBC,OAClB,MAAM,IAAIC,8BAA8BJ,GAG1C,IAAKK,EAA0CH,KAAhCI,EAAgCJ,EAAtBK,GAAAA,EAAsBL,EAAe,GAA3BM,EAAYN,EAG/CK,GAKA,OALAA,EAAWA,EAASE,SAAS,EAAG,KAKzB,CACLJ,SAHFA,EAAWA,EAASI,SAAS,EAAG,KAI9BH,SAAUA,EACVC,SAAUA,E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A,GAIjC,EAAA,8BAnCyB,SACvBb,EACAC,GACmB9B,OAAAA,QAAAC,QACD2B,EAAgBC,EAAKC,IAAIzB,KAArCoC,SAAAA,GAAGM,SAAAA,IAWT,ODSkC,SAClCxC,EACAyC,GAEA,IACMC,EApBsB,SAAC1C,EAAkB2C,GAC/C,IAAMrC,EAAaN,EAAQ2C,GAC3B,IAAKrC,EACH,MAAM,IAAII,MAAK,aAAciC,EAAoB,cAInD,OADS,GAAMrC,EAAWM,SAAWN,EAAWQ,UACrCP,QAAQ,KAAM,GAC3B,CAYmBqC,CAAsB5C,EAD5ByC,EAAeJ,QAG1B,SADoBK,EAAWD,EAAeI,MAEhD,CCjBSC,CAA4B9C,EAASoC,EAAS,CAVrD,IAAQA,EAAYF,EAAZE,QACR,IAAKA,IAAYA,EAAQC,OACvB,MAAM,IAAI3B,MAAM,oBACjB,IAAAqC,EAAA,WAAA,IAGI/C,EAAOP,OAAAA,QAAAC,QACMF,KAAYM,cAAAkD,GAA5BhD,EAAOgD,CAAsB,EAAA,CAJ9B,GAI8B,OAAAD,GAAAA,EAAAjD,KAAAiD,EAAAjD,KAAA0C,GAAAA,GAAA,EAIjC,wBCpEM,SAAuBS,GAAqC,IACV,OAAAxD,QAAAC,QAC/BC,EAAAA,QAAMC,IADd4B,yDACuB,CACpC3B,aAAc,OACd6B,OAAQ,CACNuB,EAAAA,MAEFnD,cALIC,GAQN,OADYA,EAASmB,IACV,EACb,CAAC,MAAAC,GAAA,OAAA1B,QAAA2B,OAAAD,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/muni.ts","../src/m_reverse_geocode.ts","../src/msearch.ts"],"sourcesContent":["// Muni file url\nconst MuniURL = 'https://maps.gsi.go.jp/js/muni.js';\nconst MuniRegex = /GSI\\.MUNI_ARRAY\\[\"\\d+\"\\]\\s*=\\s*'(.*?)';/g;\n\nimport axios from 'axios';\nimport { AddressResults, MuniMap } from './types';\n\n/**\n * parse muni.js\n * @param muniMap\n */\nconst parseMuniMap = (muniMap: string) => {\n const muniMapObj: MuniMap = {};\n const lines = muniMap.split('\\n');\n lines.forEach((line) => {\n if (MuniRegex.test(line)) {\n const muniRecord = parseMuniRecord(line);\n muniMapObj[muniRecord.cityCode] = muniRecord;\n }\n });\n return muniMapObj;\n};\n\n/**\n * parse muni record\n * @param line\n */\nconst parseMuniRecord = (line: string) => {\n const muniRecord = line.replace(MuniRegex, '$1');\n\n const muniRecordArray = muniRecord.split(',');\n\n // validate muni record\n if (muniRecordArray.length !== 4) {\n throw new Error(`invalid muni record: ${muniRecord}`);\n }\n\n let [prefCode, prefName, cityCode, cityName] = muniRecordArray;\n\n // if cityCode is not 5 digits, add 0 to the beginning\n cityCode = cityCode.padStart(5, '0');\n\n // if prefCode is not 2 digits, add 0 to the beginning\n prefCode = prefCode.padStart(2, '0');\n\n return {\n prefCode: prefCode,\n prefName: prefName,\n cityCode: cityCode,\n cityName: cityName,\n };\n};\n\n/**\n * Get muni map (city or ward map by city code) from GSI\n */\nconst getMuniMap = async () => {\n const response = await axios.get(MuniURL, {\n responseType: 'text',\n });\n\n const muniMap = response.data;\n return parseMuniMap(muniMap);\n};\n\n/**\n * converts muni code to address name.\n *\n * @param muniMap\n * @param muniCode\n */\nconst muniCodeToAddressName = (muniMap: MuniMap, muniCode: string) => {\n const muniRecord = muniMap[muniCode];\n if (!muniRecord) {\n throw new Error(`muni code ${muniCode} not found`);\n }\n\n const add = `${muniRecord.prefName}${muniRecord.cityName}`;\n return add.replace(/ /g, '');\n};\n\n/**\n * converts address result to address name.\n * @param muniMap\n * @param addressResults\n */\nconst addressResultsToAddressName = (\n muniMap: MuniMap,\n addressResults: AddressResults\n) => {\n const mc = addressResults.muniCd;\n const muniName = muniCodeToAddressName(muniMap, mc);\n const addrName = `${muniName}${addressResults.lv01Nm}`;\n return addrName;\n};\n\nconst getMuniMapLocations = async () => {\n const muniMap = await getMuniMap();\n // muniMap is a map of all cities and wards in Japan\n // key: city code, value: { prefCode, prefName, cityCode, cityName }\n // we need to convert this to a map of all locations in Japan\n // key: prefCode , value: { prefName, cities: { key: cityCode, value: { cityCode, cityName, wards: { key: wardCode, value: { wardCode, wardName } } } } }\n\n const muniMapLocations = {};\n Object.keys(muniMap).forEach((cityCode) => {\n const muniRecord = muniMap[cityCode];\n const { prefCode, prefName, cityName } = muniRecord;\n if (!muniMapLocations[prefCode]) {\n muniMapLocations[prefCode] = { prefName, cities: {} };\n }\n\n // if cityName contains ' ', it is a ward\n // otherwise, it is a city\n if (cityName.includes(' ')) {\n // ward name is after ' '\n const [name, wardName] = cityName.split(' ');\n // find city has the same name\n const city: any = Object.values(muniMap).find(\n (c: any) => c.cityName === name\n );\n if (!city) {\n console.log(`City ${name} not found in prefCode ${prefCode}`);\n } else {\n // add ward to city\n muniMapLocations[prefCode].cities[city.cityCode].wards[cityCode] = {\n prefCode,\n cityCode: cityCode,\n cityName: `${name}${wardName}`,\n bigCityFlag: '1',\n bigCityCode: city.cityCode,\n };\n }\n } else {\n muniMapLocations[prefCode].cities[cityCode] = {\n prefCode,\n cityCode,\n cityName,\n wards: {},\n };\n }\n });\n\n // assign bigCityFlag to each city\n Object.keys(muniMapLocations).forEach((prefCode) => {\n const pref = muniMapLocations[prefCode];\n Object.keys(pref.cities).forEach((cityCode) => {\n const city = pref.cities[cityCode];\n const isBigCity = Object.values(city.wards).length > 0;\n if (isBigCity) {\n city.bigCityFlag = '2';\n } else {\n // delete wards\n delete city.wards;\n // if city is tokyo then bigCityFlag is 3, otherwise 0\n if (city.prefCode === '13') {\n city.bigCityFlag = '3';\n } else {\n city.bigCityFlag = '0';\n }\n }\n });\n });\n\n return muniMapLocations;\n};\n\nexport {\n getMuniMap,\n getMuniMapLocations,\n muniCodeToAddressName,\n addressResultsToAddressName,\n};\n","import axios from 'axios';\n\nimport { ReverseGeocodeResults, MuniMap, MuniRecord } from './types';\nimport { addressResultsToAddressName, getMuniMap } from './muni';\nconst BaseURL = 'https://mreversegeocoder.gsi.go.jp';\n\n// cache muni map\nvar muniMap: MuniMap | null = null;\n\n/**\n * reverse geocoding by latitude and longitude to address\n * It returns town name only\n *\n * @param lat\n * @param lon\n * @returns address\n */\nconst latLonToAddress = async (\n lat: number,\n lon: number\n): Promise<ReverseGeocodeResults> => {\n try {\n const url = `${BaseURL}/reverse-geocoder/LonLatToAddress`;\n const response = await axios.get(url, {\n timeout: 500, // Timeout after 5 seconds\n responseType: 'json',\n params: {\n lat,\n lon,\n },\n });\n\n // if status is not 200\n if (response.status !== 200) {\n console.log(\"response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n }\n\n const res = response.data;\n return res;\n } catch (error: any) {\n // if it is axios error\n if (error.response) {\n console.log(\"error.response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n } else {\n console.log(\"error\");\n throw error;\n }\n }\n};\n\n/**\n * Get full address name by latitude and longitude\n * @param lat\n * @param lon\n * @returns prefecture + city + town\n */\nconst latLonToAddressName = async (\n lat: number,\n lon: number\n): Promise<string> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n muniMap = await getMuniMap();\n }\n\n return addressResultsToAddressName(muniMap, results);\n};\n\nconst latLonToAddressInfo = async (\n lat: number,\n lon: number\n): Promise<MuniRecord> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n console.log('getMuniMap');\n muniMap = await getMuniMap();\n }\n const mc = results.muniCd;\n return muniMap[mc];\n};\n\nexport {\n latLonToAddressInfo,\n getMuniMap,\n latLonToAddress,\n latLonToAddressName,\n};\n","import axios from 'axios';\n\nimport { SearchResults } from './types';\n\n// base url for msearch api\nconst BaseURL = 'https://msearch.gsi.go.jp';\n\n/**\n * search address by query\n */\nconst searchAddress = async (q: string): Promise<SearchResults> => {\n const url = `${BaseURL}/address-search/AddressSearch`;\n const response = await axios.get(url, {\n responseType: 'json',\n params: {\n q,\n },\n });\n\n const res = response.data;\n return res;\n};\n\nexport { searchAddress };\n"],"names":["MuniRegex","getMuniMap","Promise","resolve","axios","get","responseType","then","response","muniMap","muniMapObj","split","forEach","line","test","muniRecord","replace","muniRecordArray","length","Error","prefCode","prefName","cityCode","cityName","padStart","parseMuniRecord","parseMuniMap","data","e","reject","latLonToAddress","lat","lon","BaseURL","timeout","params","status","console","log","err","name","_catch","error","res","_temp4","results","muniCd","_temp3","_getMuniMap2","_temp2","addressResults","muniName","muniCode","muniCodeToAddressName","lv01Nm","addressResultsToAddressName","_temp","_getMuniMap","q"],"mappings":"+GAEMA,EAAY,2CAsDZC,EAAU,eAAcC,OAAAA,QAAAC,QACLC,UAAMC,IAxDf,oCAwD4B,CACxCC,aAAc,UACdC,cAFIC,GAKN,OAnDmB,SAACC,GACpB,IAAMC,EAAsB,CAAA,EAQ5B,OAPcD,EAAQE,MAAM,MACtBC,QAAQ,SAACC,GACb,GAAIb,EAAUc,KAAKD,GAAO,CACxB,IAAME,EAWY,SAACF,GACvB,IAAME,EAAaF,EAAKG,QAAQhB,EAAW,MAErCiB,EAAkBF,EAAWJ,MAAM,KAGzC,GAA+B,IAA3BM,EAAgBC,OAClB,MAAM,IAAIC,8BAA8BJ,GAG1C,IAAKK,EAA0CH,KAAhCI,EAAgCJ,EAAtBK,GAAAA,EAAsBL,EAAe,GAA3BM,EAAYN,EAG/CK,GAKA,OALAA,EAAWA,EAASE,SAAS,EAAG,KAKzB,CACLJ,SAHFA,EAAWA,EAASI,SAAS,EAAG,KAI9BH,SAAUA,EACVC,SAAUA,EACVC,SAAUA,EAEd,CAnCyBE,CAAgBZ,GACnCH,EAAWK,EAAWO,UAAYP,CACnC,CACH,GACOL,CACT,CAyCSgB,CADSlB,EAASmB,KACI,EAC/B,CAAC,MAAAC,GAAA1B,OAAAA,QAAA2B,OAAAD,EAQD,CAAA,EChEInB,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,GAC/C,IAAMrC,EAAaN,EAAQ2C,GAC3B,IAAKrC,EACH,MAAM,IAAII,MAAK,aAAciC,EAAoB,cAInD,OADS,GAAMrC,EAAWM,SAAWN,EAAWQ,UACrCP,QAAQ,KAAM,GAC3B,CAYmBqC,CAAsB5C,EAD5ByC,EAAeJ,QAG1B,SADoBK,EAAWD,EAAeI,MAEhD,CCjBSC,CAA4B9C,EAASoC,EAAS,CAVrD,IAAQA,EAAYF,EAAZE,QACR,IAAKA,IAAYA,EAAQC,OACvB,MAAM,IAAI3B,MAAM,oBACjB,IAAAqC,EAAA,WAAA,IAGI/C,EAAOP,OAAAA,QAAAC,QACMF,KAAYM,cAAAkD,GAA5BhD,EAAOgD,CAAsB,EAAA,CAJ9B,GAI8B,OAAAD,GAAAA,EAAAjD,KAAAiD,EAAAjD,KAAA0C,GAAAA,GAAA,EAIjC,wBCpEM,SAAuBS,GAAqC,IACV,OAAAxD,QAAAC,QAC/BC,EAAAA,QAAMC,IADd4B,yDACuB,CACpC3B,aAAc,OACd6B,OAAQ,CACNuB,EAAAA,MAEFnD,cALIC,GAQN,OADYA,EAASmB,IACV,EACb,CAAC,MAAAC,GAAA,OAAA1B,QAAA2B,OAAAD,EAAA,CAAA"}
|
package/dist/index.module.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import r from"axios";var e=/GSI\.MUNI_ARRAY\["\d+"\]\s*=\s*'(.*?)';/g,t=function(){try{return Promise.resolve(r.get("https://maps.gsi.go.jp/js/muni.js",{responseType:"text"})).then(function(r){return function(r){var t={};return r.split("\n").forEach(function(r){if(e.test(r)){var n=function(r){var t=r.replace(e,"$1"),n=t.split(",");if(4!==n.length)throw new Error("invalid muni record: "+t);var o=n[0],s=n[1],i=n[2],u=n[3];return i=i.padStart(5,"0"),{prefCode:o=o.padStart(2,"0"),prefName:s,cityCode:i,cityName:u}}(r);t[n.cityCode]=n}}),t}(r.data)})}catch(r){return Promise.reject(r)}},n=null,o=function(e,t){try{return Promise.resolve(function(n,o){try{var s=Promise.resolve(r.get("https://mreversegeocoder.gsi.go.jp/reverse-geocoder/LonLatToAddress",{timeout:
|
|
1
|
+
import r from"axios";var e=/GSI\.MUNI_ARRAY\["\d+"\]\s*=\s*'(.*?)';/g,t=function(){try{return Promise.resolve(r.get("https://maps.gsi.go.jp/js/muni.js",{responseType:"text"})).then(function(r){return function(r){var t={};return r.split("\n").forEach(function(r){if(e.test(r)){var n=function(r){var t=r.replace(e,"$1"),n=t.split(",");if(4!==n.length)throw new Error("invalid muni record: "+t);var o=n[0],s=n[1],i=n[2],u=n[3];return i=i.padStart(5,"0"),{prefCode:o=o.padStart(2,"0"),prefName:s,cityCode:i,cityName:u}}(r);t[n.cityCode]=n}}),t}(r.data)})}catch(r){return Promise.reject(r)}},n=null,o=function(e,t){try{return Promise.resolve(function(n,o){try{var s=Promise.resolve(r.get("https://mreversegeocoder.gsi.go.jp/reverse-geocoder/LonLatToAddress",{timeout:500,responseType:"json",params:{lat:e,lon:t}})).then(function(r){if(200!==r.status){console.log("response");var e=new Error("Failed to get address. status is not 200");throw e.name="API_ERROR",e}return r.data})}catch(r){return o(r)}return s&&s.then?s.then(void 0,o):s}(0,function(r){if(r.response){console.log("error.response");var e=new Error("Failed to get address. status is not 200");throw e.name="API_ERROR",e}throw console.log("error"),r}))}catch(r){return Promise.reject(r)}},s=function(r,e){return Promise.resolve(o(r,e)).then(function(r){function e(){return function(r,e){var t=function(r,e){var t=r[e];if(!t)throw new Error("muni code "+e+" not found");return(""+t.prefName+t.cityName).replace(/ /g,"")}(r,e.muniCd);return""+t+e.lv01Nm}(n,o)}var o=r.results;if(!o||!o.muniCd)throw new Error("No address found");var s=function(){if(!n)return Promise.resolve(t()).then(function(r){n=r})}();return s&&s.then?s.then(e):e()})},i=function(r,e){return Promise.resolve(o(r,e)).then(function(r){function e(){return n[o.muniCd]}var o=r.results;if(!o||!o.muniCd)throw new Error("No address found");var s=function(){if(!n)return console.log("getMuniMap"),Promise.resolve(t()).then(function(r){n=r})}();return s&&s.then?s.then(e):e()})},u=function(e){try{return Promise.resolve(r.get("https://msearch.gsi.go.jp/address-search/AddressSearch",{responseType:"json",params:{q:e}})).then(function(r){return r.data})}catch(r){return Promise.reject(r)}};export{t as getMuniMap,o as latLonToAddress,i as latLonToAddressInfo,s as latLonToAddressName,u as searchAddress};
|
|
2
2
|
//# sourceMappingURL=index.module.js.map
|
package/dist/index.module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.module.js","sources":["../src/muni.ts","../src/m_reverse_geocode.ts","../src/msearch.ts"],"sourcesContent":["// Muni file url\nconst MuniURL = 'https://maps.gsi.go.jp/js/muni.js';\nconst MuniRegex = /GSI\\.MUNI_ARRAY\\[\"\\d+\"\\]\\s*=\\s*'(.*?)';/g;\n\nimport axios from 'axios';\nimport { AddressResults, MuniMap } from './types';\n\n/**\n * parse muni.js\n * @param muniMap\n */\nconst parseMuniMap = (muniMap: string) => {\n const muniMapObj: MuniMap = {};\n const lines = muniMap.split('\\n');\n lines.forEach((line) => {\n if (MuniRegex.test(line)) {\n const muniRecord = parseMuniRecord(line);\n muniMapObj[muniRecord.cityCode] = muniRecord;\n }\n });\n return muniMapObj;\n};\n\n/**\n * parse muni record\n * @param line\n */\nconst parseMuniRecord = (line: string) => {\n const muniRecord = line.replace(MuniRegex, '$1');\n\n const muniRecordArray = muniRecord.split(',');\n\n // validate muni record\n if (muniRecordArray.length !== 4) {\n throw new Error(`invalid muni record: ${muniRecord}`);\n }\n\n let [prefCode, prefName, cityCode, cityName] = muniRecordArray;\n\n // if cityCode is not 5 digits, add 0 to the beginning\n cityCode = cityCode.padStart(5, '0');\n\n // if prefCode is not 2 digits, add 0 to the beginning\n prefCode = prefCode.padStart(2, '0');\n\n return {\n prefCode: prefCode,\n prefName: prefName,\n cityCode: cityCode,\n cityName: cityName,\n };\n};\n\n/**\n * Get muni map (city or ward map by city code) from GSI\n */\nconst getMuniMap = async () => {\n const response = await axios.get(MuniURL, {\n responseType: 'text',\n });\n\n const muniMap = response.data;\n return parseMuniMap(muniMap);\n};\n\n/**\n * converts muni code to address name.\n *\n * @param muniMap\n * @param muniCode\n */\nconst muniCodeToAddressName = (muniMap: MuniMap, muniCode: string) => {\n const muniRecord = muniMap[muniCode];\n if (!muniRecord) {\n throw new Error(`muni code ${muniCode} not found`);\n }\n\n const add = `${muniRecord.prefName}${muniRecord.cityName}`;\n return add.replace(/ /g, '');\n};\n\n/**\n * converts address result to address name.\n * @param muniMap\n * @param addressResults\n */\nconst addressResultsToAddressName = (\n muniMap: MuniMap,\n addressResults: AddressResults\n) => {\n const mc = addressResults.muniCd;\n const muniName = muniCodeToAddressName(muniMap, mc);\n const addrName = `${muniName}${addressResults.lv01Nm}`;\n return addrName;\n};\n\nconst getMuniMapLocations = async () => {\n const muniMap = await getMuniMap();\n // muniMap is a map of all cities and wards in Japan\n // key: city code, value: { prefCode, prefName, cityCode, cityName }\n // we need to convert this to a map of all locations in Japan\n // key: prefCode , value: { prefName, cities: { key: cityCode, value: { cityCode, cityName, wards: { key: wardCode, value: { wardCode, wardName } } } } }\n\n const muniMapLocations = {};\n Object.keys(muniMap).forEach((cityCode) => {\n const muniRecord = muniMap[cityCode];\n const { prefCode, prefName, cityName } = muniRecord;\n if (!muniMapLocations[prefCode]) {\n muniMapLocations[prefCode] = { prefName, cities: {} };\n }\n\n // if cityName contains ' ', it is a ward\n // otherwise, it is a city\n if (cityName.includes(' ')) {\n // ward name is after ' '\n const [name, wardName] = cityName.split(' ');\n // find city has the same name\n const city: any = Object.values(muniMap).find(\n (c: any) => c.cityName === name\n );\n if (!city) {\n console.log(`City ${name} not found in prefCode ${prefCode}`);\n } else {\n // add ward to city\n muniMapLocations[prefCode].cities[city.cityCode].wards[cityCode] = {\n prefCode,\n cityCode: cityCode,\n cityName: `${name}${wardName}`,\n bigCityFlag: '1',\n bigCityCode: city.cityCode,\n };\n }\n } else {\n muniMapLocations[prefCode].cities[cityCode] = {\n prefCode,\n cityCode,\n cityName,\n wards: {},\n };\n }\n });\n\n // assign bigCityFlag to each city\n Object.keys(muniMapLocations).forEach((prefCode) => {\n const pref = muniMapLocations[prefCode];\n Object.keys(pref.cities).forEach((cityCode) => {\n const city = pref.cities[cityCode];\n const isBigCity = Object.values(city.wards).length > 0;\n if (isBigCity) {\n city.bigCityFlag = '2';\n } else {\n // delete wards\n delete city.wards;\n // if city is tokyo then bigCityFlag is 3, otherwise 0\n if (city.prefCode === '13') {\n city.bigCityFlag = '3';\n } else {\n city.bigCityFlag = '0';\n }\n }\n });\n });\n\n return muniMapLocations;\n};\n\nexport {\n getMuniMap,\n getMuniMapLocations,\n muniCodeToAddressName,\n addressResultsToAddressName,\n};\n","import axios from 'axios';\n\nimport { ReverseGeocodeResults, MuniMap, MuniRecord } from './types';\nimport { addressResultsToAddressName, getMuniMap } from './muni';\nconst BaseURL = 'https://mreversegeocoder.gsi.go.jp';\n\n// cache muni map\nvar muniMap: MuniMap | null = null;\n\n/**\n * reverse geocoding by latitude and longitude to address\n * It returns town name only\n *\n * @param lat\n * @param lon\n * @returns address\n */\nconst latLonToAddress = async (\n lat: number,\n lon: number\n): Promise<ReverseGeocodeResults> => {\n try {\n const url = `${BaseURL}/reverse-geocoder/LonLatToAddress`;\n const response = await axios.get(url, {\n timeout: 5000, // Timeout after 5 seconds\n responseType: 'json',\n params: {\n lat,\n lon,\n },\n });\n\n // if status is not 200\n if (response.status !== 200) {\n console.log(\"response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n }\n\n const res = response.data;\n return res;\n } catch (error: any) {\n // if it is axios error\n if (error.response) {\n console.log(\"error.response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n } else {\n console.log(\"error\");\n throw error;\n }\n }\n};\n\n/**\n * Get full address name by latitude and longitude\n * @param lat\n * @param lon\n * @returns prefecture + city + town\n */\nconst latLonToAddressName = async (\n lat: number,\n lon: number\n): Promise<string> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n muniMap = await getMuniMap();\n }\n\n return addressResultsToAddressName(muniMap, results);\n};\n\nconst latLonToAddressInfo = async (\n lat: number,\n lon: number\n): Promise<MuniRecord> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n console.log('getMuniMap');\n muniMap = await getMuniMap();\n }\n const mc = results.muniCd;\n return muniMap[mc];\n};\n\nexport {\n latLonToAddressInfo,\n getMuniMap,\n latLonToAddress,\n latLonToAddressName,\n};\n","import axios from 'axios';\n\nimport { SearchResults } from './types';\n\n// base url for msearch api\nconst BaseURL = 'https://msearch.gsi.go.jp';\n\n/**\n * search address by query\n */\nconst searchAddress = async (q: string): Promise<SearchResults> => {\n const url = `${BaseURL}/address-search/AddressSearch`;\n const response = await axios.get(url, {\n responseType: 'json',\n params: {\n q,\n },\n });\n\n const res = response.data;\n return res;\n};\n\nexport { searchAddress };\n"],"names":["MuniRegex","getMuniMap","Promise","resolve","axios","get","responseType","then","response","muniMap","muniMapObj","split","forEach","line","test","muniRecord","replace","muniRecordArray","length","Error","prefCode","prefName","cityCode","cityName","padStart","parseMuniRecord","parseMuniMap","data","e","reject","latLonToAddress","lat","lon","BaseURL","timeout","params","status","console","log","err","name","_catch","error","latLonToAddressName","res","_temp2","addressResults","muniName","muniCode","muniCodeToAddressName","muniCd","lv01Nm","addressResultsToAddressName","results","_temp","_getMuniMap","latLonToAddressInfo","_temp4","_temp3","_getMuniMap2","searchAddress","q"],"mappings":"qBACA,IACMA,EAAY,2CAsDZC,EAAU,eAAcC,OAAAA,QAAAC,QACLC,EAAMC,IAxDf,oCAwD4B,CACxCC,aAAc,UACdC,cAFIC,GAKN,OAnDmB,SAACC,GACpB,IAAMC,EAAsB,CAAA,EAQ5B,OAPcD,EAAQE,MAA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,CACpC3B,aAAc,OACd6B,OAAQ,CACN0B,EAAAA,MAEFtD,cALIC,GAQN,OADYA,EAASmB,IACV,EACb,CAAC,MAAAC,GAAA,OAAA1B,QAAA2B,OAAAD,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.module.js","sources":["../src/muni.ts","../src/m_reverse_geocode.ts","../src/msearch.ts"],"sourcesContent":["// Muni file url\nconst MuniURL = 'https://maps.gsi.go.jp/js/muni.js';\nconst MuniRegex = /GSI\\.MUNI_ARRAY\\[\"\\d+\"\\]\\s*=\\s*'(.*?)';/g;\n\nimport axios from 'axios';\nimport { AddressResults, MuniMap } from './types';\n\n/**\n * parse muni.js\n * @param muniMap\n */\nconst parseMuniMap = (muniMap: string) => {\n const muniMapObj: MuniMap = {};\n const lines = muniMap.split('\\n');\n lines.forEach((line) => {\n if (MuniRegex.test(line)) {\n const muniRecord = parseMuniRecord(line);\n muniMapObj[muniRecord.cityCode] = muniRecord;\n }\n });\n return muniMapObj;\n};\n\n/**\n * parse muni record\n * @param line\n */\nconst parseMuniRecord = (line: string) => {\n const muniRecord = line.replace(MuniRegex, '$1');\n\n const muniRecordArray = muniRecord.split(',');\n\n // validate muni record\n if (muniRecordArray.length !== 4) {\n throw new Error(`invalid muni record: ${muniRecord}`);\n }\n\n let [prefCode, prefName, cityCode, cityName] = muniRecordArray;\n\n // if cityCode is not 5 digits, add 0 to the beginning\n cityCode = cityCode.padStart(5, '0');\n\n // if prefCode is not 2 digits, add 0 to the beginning\n prefCode = prefCode.padStart(2, '0');\n\n return {\n prefCode: prefCode,\n prefName: prefName,\n cityCode: cityCode,\n cityName: cityName,\n };\n};\n\n/**\n * Get muni map (city or ward map by city code) from GSI\n */\nconst getMuniMap = async () => {\n const response = await axios.get(MuniURL, {\n responseType: 'text',\n });\n\n const muniMap = response.data;\n return parseMuniMap(muniMap);\n};\n\n/**\n * converts muni code to address name.\n *\n * @param muniMap\n * @param muniCode\n */\nconst muniCodeToAddressName = (muniMap: MuniMap, muniCode: string) => {\n const muniRecord = muniMap[muniCode];\n if (!muniRecord) {\n throw new Error(`muni code ${muniCode} not found`);\n }\n\n const add = `${muniRecord.prefName}${muniRecord.cityName}`;\n return add.replace(/ /g, '');\n};\n\n/**\n * converts address result to address name.\n * @param muniMap\n * @param addressResults\n */\nconst addressResultsToAddressName = (\n muniMap: MuniMap,\n addressResults: AddressResults\n) => {\n const mc = addressResults.muniCd;\n const muniName = muniCodeToAddressName(muniMap, mc);\n const addrName = `${muniName}${addressResults.lv01Nm}`;\n return addrName;\n};\n\nconst getMuniMapLocations = async () => {\n const muniMap = await getMuniMap();\n // muniMap is a map of all cities and wards in Japan\n // key: city code, value: { prefCode, prefName, cityCode, cityName }\n // we need to convert this to a map of all locations in Japan\n // key: prefCode , value: { prefName, cities: { key: cityCode, value: { cityCode, cityName, wards: { key: wardCode, value: { wardCode, wardName } } } } }\n\n const muniMapLocations = {};\n Object.keys(muniMap).forEach((cityCode) => {\n const muniRecord = muniMap[cityCode];\n const { prefCode, prefName, cityName } = muniRecord;\n if (!muniMapLocations[prefCode]) {\n muniMapLocations[prefCode] = { prefName, cities: {} };\n }\n\n // if cityName contains ' ', it is a ward\n // otherwise, it is a city\n if (cityName.includes(' ')) {\n // ward name is after ' '\n const [name, wardName] = cityName.split(' ');\n // find city has the same name\n const city: any = Object.values(muniMap).find(\n (c: any) => c.cityName === name\n );\n if (!city) {\n console.log(`City ${name} not found in prefCode ${prefCode}`);\n } else {\n // add ward to city\n muniMapLocations[prefCode].cities[city.cityCode].wards[cityCode] = {\n prefCode,\n cityCode: cityCode,\n cityName: `${name}${wardName}`,\n bigCityFlag: '1',\n bigCityCode: city.cityCode,\n };\n }\n } else {\n muniMapLocations[prefCode].cities[cityCode] = {\n prefCode,\n cityCode,\n cityName,\n wards: {},\n };\n }\n });\n\n // assign bigCityFlag to each city\n Object.keys(muniMapLocations).forEach((prefCode) => {\n const pref = muniMapLocations[prefCode];\n Object.keys(pref.cities).forEach((cityCode) => {\n const city = pref.cities[cityCode];\n const isBigCity = Object.values(city.wards).length > 0;\n if (isBigCity) {\n city.bigCityFlag = '2';\n } else {\n // delete wards\n delete city.wards;\n // if city is tokyo then bigCityFlag is 3, otherwise 0\n if (city.prefCode === '13') {\n city.bigCityFlag = '3';\n } else {\n city.bigCityFlag = '0';\n }\n }\n });\n });\n\n return muniMapLocations;\n};\n\nexport {\n getMuniMap,\n getMuniMapLocations,\n muniCodeToAddressName,\n addressResultsToAddressName,\n};\n","import axios from 'axios';\n\nimport { ReverseGeocodeResults, MuniMap, MuniRecord } from './types';\nimport { addressResultsToAddressName, getMuniMap } from './muni';\nconst BaseURL = 'https://mreversegeocoder.gsi.go.jp';\n\n// cache muni map\nvar muniMap: MuniMap | null = null;\n\n/**\n * reverse geocoding by latitude and longitude to address\n * It returns town name only\n *\n * @param lat\n * @param lon\n * @returns address\n */\nconst latLonToAddress = async (\n lat: number,\n lon: number\n): Promise<ReverseGeocodeResults> => {\n try {\n const url = `${BaseURL}/reverse-geocoder/LonLatToAddress`;\n const response = await axios.get(url, {\n timeout: 500, // Timeout after 5 seconds\n responseType: 'json',\n params: {\n lat,\n lon,\n },\n });\n\n // if status is not 200\n if (response.status !== 200) {\n console.log(\"response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n }\n\n const res = response.data;\n return res;\n } catch (error: any) {\n // if it is axios error\n if (error.response) {\n console.log(\"error.response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n } else {\n console.log(\"error\");\n throw error;\n }\n }\n};\n\n/**\n * Get full address name by latitude and longitude\n * @param lat\n * @param lon\n * @returns prefecture + city + town\n */\nconst latLonToAddressName = async (\n lat: number,\n lon: number\n): Promise<string> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n muniMap = await getMuniMap();\n }\n\n return addressResultsToAddressName(muniMap, results);\n};\n\nconst latLonToAddressInfo = async (\n lat: number,\n lon: number\n): Promise<MuniRecord> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n console.log('getMuniMap');\n muniMap = await getMuniMap();\n }\n const mc = results.muniCd;\n return muniMap[mc];\n};\n\nexport {\n latLonToAddressInfo,\n getMuniMap,\n latLonToAddress,\n latLonToAddressName,\n};\n","import axios from 'axios';\n\nimport { SearchResults } from './types';\n\n// base url for msearch api\nconst BaseURL = 'https://msearch.gsi.go.jp';\n\n/**\n * search address by query\n */\nconst searchAddress = async (q: string): Promise<SearchResults> => {\n const url = `${BaseURL}/address-search/AddressSearch`;\n const response = await axios.get(url, {\n responseType: 'json',\n params: {\n q,\n },\n });\n\n const res = response.data;\n return res;\n};\n\nexport { searchAddress };\n"],"names":["MuniRegex","getMuniMap","Promise","resolve","axios","get","responseType","then","response","muniMap","muniMapObj","split","forEach","line","test","muniRecord","replace","muniRecordArray","length","Error","prefCode","prefName","cityCode","cityName","padStart","parseMuniRecord","parseMuniMap","data","e","reject","latLonToAddress","lat","lon","BaseURL","timeout","params","status","console","log","err","name","_catch","error","latLonToAddressName","res","_temp2","addressResults","muniName","muniCode","muniCodeToAddressName","muniCd","lv01Nm","addressResultsToAddressName","results","_temp","_getMuniMap","latLonToAddressInfo","_temp4","_temp3","_getMuniMap2","searchAddress","q"],"mappings":"qBACA,IACMA,EAAY,2CAsDZC,EAAU,eAAcC,OAAAA,QAAAC,QACLC,EAAMC,IAxDf,oCAwD4B,CACxCC,aAAc,UACdC,cAFIC,GAKN,OAnDmB,SAACC,GACpB,IAAMC,EAAsB,CAAA,EAQ5B,OAPcD,EAAQE,MAAM,MACtBC,QAAQ,SAACC,GACb,GAAIb,EAAUc,KAAKD,GAAO,CACxB,IAAME,EAWY,SAACF,GACvB,IAAME,EAAaF,EAAKG,QAAQhB,EAAW,MAErCiB,EAAkBF,EAAWJ,M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
package/dist/index.umd.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],r):r((e||self).jsMsearchGsiJp={},e.axios)}(this,function(e,r){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=/*#__PURE__*/t(r),o=/GSI\.MUNI_ARRAY\["\d+"\]\s*=\s*'(.*?)';/g,s=function(){try{return Promise.resolve(n.default.get("https://maps.gsi.go.jp/js/muni.js",{responseType:"text"})).then(function(e){return function(e){var r={};return e.split("\n").forEach(function(e){if(o.test(e)){var t=function(e){var r=e.replace(o,"$1"),t=r.split(",");if(4!==t.length)throw new Error("invalid muni record: "+r);var n=t[0],s=t[1],i=t[2],u=t[3];return i=i.padStart(5,"0"),{prefCode:n=n.padStart(2,"0"),prefName:s,cityCode:i,cityName:u}}(e);r[t.cityCode]=t}}),r}(e.data)})}catch(e){return Promise.reject(e)}},i=null,u=function(e,r){try{return Promise.resolve(function(t,o){try{var s=Promise.resolve(n.default.get("https://mreversegeocoder.gsi.go.jp/reverse-geocoder/LonLatToAddress",{timeout:
|
|
1
|
+
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("axios")):"function"==typeof define&&define.amd?define(["exports","axios"],r):r((e||self).jsMsearchGsiJp={},e.axios)}(this,function(e,r){function t(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var n=/*#__PURE__*/t(r),o=/GSI\.MUNI_ARRAY\["\d+"\]\s*=\s*'(.*?)';/g,s=function(){try{return Promise.resolve(n.default.get("https://maps.gsi.go.jp/js/muni.js",{responseType:"text"})).then(function(e){return function(e){var r={};return e.split("\n").forEach(function(e){if(o.test(e)){var t=function(e){var r=e.replace(o,"$1"),t=r.split(",");if(4!==t.length)throw new Error("invalid muni record: "+r);var n=t[0],s=t[1],i=t[2],u=t[3];return i=i.padStart(5,"0"),{prefCode:n=n.padStart(2,"0"),prefName:s,cityCode:i,cityName:u}}(e);r[t.cityCode]=t}}),r}(e.data)})}catch(e){return Promise.reject(e)}},i=null,u=function(e,r){try{return Promise.resolve(function(t,o){try{var s=Promise.resolve(n.default.get("https://mreversegeocoder.gsi.go.jp/reverse-geocoder/LonLatToAddress",{timeout:500,responseType:"json",params:{lat:e,lon:r}})).then(function(e){if(200!==e.status){console.log("response");var r=new Error("Failed to get address. status is not 200");throw r.name="API_ERROR",r}return e.data})}catch(e){return o(e)}return s&&s.then?s.then(void 0,o):s}(0,function(e){if(e.response){console.log("error.response");var r=new Error("Failed to get address. status is not 200");throw r.name="API_ERROR",r}throw console.log("error"),e}))}catch(e){return Promise.reject(e)}};e.getMuniMap=s,e.latLonToAddress=u,e.latLonToAddressInfo=function(e,r){return Promise.resolve(u(e,r)).then(function(e){function r(){return i[t.muniCd]}var t=e.results;if(!t||!t.muniCd)throw new Error("No address found");var n=function(){if(!i)return console.log("getMuniMap"),Promise.resolve(s()).then(function(e){i=e})}();return n&&n.then?n.then(r):r()})},e.latLonToAddressName=function(e,r){return Promise.resolve(u(e,r)).then(function(e){function r(){return function(e,r){var t=function(e,r){var t=e[r];if(!t)throw new Error("muni code "+r+" not found");return(""+t.prefName+t.cityName).replace(/ /g,"")}(e,r.muniCd);return""+t+r.lv01Nm}(i,t)}var t=e.results;if(!t||!t.muniCd)throw new Error("No address found");var n=function(){if(!i)return Promise.resolve(s()).then(function(e){i=e})}();return n&&n.then?n.then(r):r()})},e.searchAddress=function(e){try{return Promise.resolve(n.default.get("https://msearch.gsi.go.jp/address-search/AddressSearch",{responseType:"json",params:{q:e}})).then(function(e){return e.data})}catch(e){return Promise.reject(e)}}});
|
|
2
2
|
//# sourceMappingURL=index.umd.js.map
|
package/dist/index.umd.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../src/muni.ts","../src/m_reverse_geocode.ts","../src/msearch.ts"],"sourcesContent":["// Muni file url\nconst MuniURL = 'https://maps.gsi.go.jp/js/muni.js';\nconst MuniRegex = /GSI\\.MUNI_ARRAY\\[\"\\d+\"\\]\\s*=\\s*'(.*?)';/g;\n\nimport axios from 'axios';\nimport { AddressResults, MuniMap } from './types';\n\n/**\n * parse muni.js\n * @param muniMap\n */\nconst parseMuniMap = (muniMap: string) => {\n const muniMapObj: MuniMap = {};\n const lines = muniMap.split('\\n');\n lines.forEach((line) => {\n if (MuniRegex.test(line)) {\n const muniRecord = parseMuniRecord(line);\n muniMapObj[muniRecord.cityCode] = muniRecord;\n }\n });\n return muniMapObj;\n};\n\n/**\n * parse muni record\n * @param line\n */\nconst parseMuniRecord = (line: string) => {\n const muniRecord = line.replace(MuniRegex, '$1');\n\n const muniRecordArray = muniRecord.split(',');\n\n // validate muni record\n if (muniRecordArray.length !== 4) {\n throw new Error(`invalid muni record: ${muniRecord}`);\n }\n\n let [prefCode, prefName, cityCode, cityName] = muniRecordArray;\n\n // if cityCode is not 5 digits, add 0 to the beginning\n cityCode = cityCode.padStart(5, '0');\n\n // if prefCode is not 2 digits, add 0 to the beginning\n prefCode = prefCode.padStart(2, '0');\n\n return {\n prefCode: prefCode,\n prefName: prefName,\n cityCode: cityCode,\n cityName: cityName,\n };\n};\n\n/**\n * Get muni map (city or ward map by city code) from GSI\n */\nconst getMuniMap = async () => {\n const response = await axios.get(MuniURL, {\n responseType: 'text',\n });\n\n const muniMap = response.data;\n return parseMuniMap(muniMap);\n};\n\n/**\n * converts muni code to address name.\n *\n * @param muniMap\n * @param muniCode\n */\nconst muniCodeToAddressName = (muniMap: MuniMap, muniCode: string) => {\n const muniRecord = muniMap[muniCode];\n if (!muniRecord) {\n throw new Error(`muni code ${muniCode} not found`);\n }\n\n const add = `${muniRecord.prefName}${muniRecord.cityName}`;\n return add.replace(/ /g, '');\n};\n\n/**\n * converts address result to address name.\n * @param muniMap\n * @param addressResults\n */\nconst addressResultsToAddressName = (\n muniMap: MuniMap,\n addressResults: AddressResults\n) => {\n const mc = addressResults.muniCd;\n const muniName = muniCodeToAddressName(muniMap, mc);\n const addrName = `${muniName}${addressResults.lv01Nm}`;\n return addrName;\n};\n\nconst getMuniMapLocations = async () => {\n const muniMap = await getMuniMap();\n // muniMap is a map of all cities and wards in Japan\n // key: city code, value: { prefCode, prefName, cityCode, cityName }\n // we need to convert this to a map of all locations in Japan\n // key: prefCode , value: { prefName, cities: { key: cityCode, value: { cityCode, cityName, wards: { key: wardCode, value: { wardCode, wardName } } } } }\n\n const muniMapLocations = {};\n Object.keys(muniMap).forEach((cityCode) => {\n const muniRecord = muniMap[cityCode];\n const { prefCode, prefName, cityName } = muniRecord;\n if (!muniMapLocations[prefCode]) {\n muniMapLocations[prefCode] = { prefName, cities: {} };\n }\n\n // if cityName contains ' ', it is a ward\n // otherwise, it is a city\n if (cityName.includes(' ')) {\n // ward name is after ' '\n const [name, wardName] = cityName.split(' ');\n // find city has the same name\n const city: any = Object.values(muniMap).find(\n (c: any) => c.cityName === name\n );\n if (!city) {\n console.log(`City ${name} not found in prefCode ${prefCode}`);\n } else {\n // add ward to city\n muniMapLocations[prefCode].cities[city.cityCode].wards[cityCode] = {\n prefCode,\n cityCode: cityCode,\n cityName: `${name}${wardName}`,\n bigCityFlag: '1',\n bigCityCode: city.cityCode,\n };\n }\n } else {\n muniMapLocations[prefCode].cities[cityCode] = {\n prefCode,\n cityCode,\n cityName,\n wards: {},\n };\n }\n });\n\n // assign bigCityFlag to each city\n Object.keys(muniMapLocations).forEach((prefCode) => {\n const pref = muniMapLocations[prefCode];\n Object.keys(pref.cities).forEach((cityCode) => {\n const city = pref.cities[cityCode];\n const isBigCity = Object.values(city.wards).length > 0;\n if (isBigCity) {\n city.bigCityFlag = '2';\n } else {\n // delete wards\n delete city.wards;\n // if city is tokyo then bigCityFlag is 3, otherwise 0\n if (city.prefCode === '13') {\n city.bigCityFlag = '3';\n } else {\n city.bigCityFlag = '0';\n }\n }\n });\n });\n\n return muniMapLocations;\n};\n\nexport {\n getMuniMap,\n getMuniMapLocations,\n muniCodeToAddressName,\n addressResultsToAddressName,\n};\n","import axios from 'axios';\n\nimport { ReverseGeocodeResults, MuniMap, MuniRecord } from './types';\nimport { addressResultsToAddressName, getMuniMap } from './muni';\nconst BaseURL = 'https://mreversegeocoder.gsi.go.jp';\n\n// cache muni map\nvar muniMap: MuniMap | null = null;\n\n/**\n * reverse geocoding by latitude and longitude to address\n * It returns town name only\n *\n * @param lat\n * @param lon\n * @returns address\n */\nconst latLonToAddress = async (\n lat: number,\n lon: number\n): Promise<ReverseGeocodeResults> => {\n try {\n const url = `${BaseURL}/reverse-geocoder/LonLatToAddress`;\n const response = await axios.get(url, {\n timeout: 5000, // Timeout after 5 seconds\n responseType: 'json',\n params: {\n lat,\n lon,\n },\n });\n\n // if status is not 200\n if (response.status !== 200) {\n console.log(\"response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n }\n\n const res = response.data;\n return res;\n } catch (error: any) {\n // if it is axios error\n if (error.response) {\n console.log(\"error.response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n } else {\n console.log(\"error\");\n throw error;\n }\n }\n};\n\n/**\n * Get full address name by latitude and longitude\n * @param lat\n * @param lon\n * @returns prefecture + city + town\n */\nconst latLonToAddressName = async (\n lat: number,\n lon: number\n): Promise<string> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n muniMap = await getMuniMap();\n }\n\n return addressResultsToAddressName(muniMap, results);\n};\n\nconst latLonToAddressInfo = async (\n lat: number,\n lon: number\n): Promise<MuniRecord> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n console.log('getMuniMap');\n muniMap = await getMuniMap();\n }\n const mc = results.muniCd;\n return muniMap[mc];\n};\n\nexport {\n latLonToAddressInfo,\n getMuniMap,\n latLonToAddress,\n latLonToAddressName,\n};\n","import axios from 'axios';\n\nimport { SearchResults } from './types';\n\n// base url for msearch api\nconst BaseURL = 'https://msearch.gsi.go.jp';\n\n/**\n * search address by query\n */\nconst searchAddress = async (q: string): Promise<SearchResults> => {\n const url = `${BaseURL}/address-search/AddressSearch`;\n const response = await axios.get(url, {\n responseType: 'json',\n params: {\n q,\n },\n });\n\n const res = response.data;\n return res;\n};\n\nexport { searchAddress };\n"],"names":["MuniRegex","getMuniMap","Promise","resolve","axios","get","responseType","then","response","muniMap","muniMapObj","split","forEach","line","test","muniRecord","replace","muniRecordArray","length","Error","prefCode","prefName","cityCode","cityName","padStart","parseMuniRecord","parseMuniMap","data","e","reject","latLonToAddress","lat","lon","BaseURL","timeout","params","status","console","log","err","name","_catch","error","res","_temp4","results","muniCd","_temp3","_getMuniMap2","_temp2","addressResults","muniName","muniCode","muniCodeToAddressName","lv01Nm","addressResultsToAddressName","_temp","_getMuniMap","q"],"mappings":"2WAEMA,EAAY,2CAsDZC,EAAU,eAAcC,OAAAA,QAAAC,QACLC,UAAMC,IAxDf,oCAwD4B,CACxCC,aAAc,UACdC,cAFIC,GAKN,OAnDmB,SAACC,GACpB,IAAMC,EAAsB,CAAA,EAQ5B,OAPcD,EAAQE,MAAM,MACtBC,QAAQ,SAACC,GACb,GAAIb,EAAUc,KAAKD,GAAO,CACxB,IAAME,EAWY,SAACF,GACvB,IAAME,EAAaF,EAAKG,QAAQhB,EAAW,MAErCiB,EAAkBF,EAAWJ,MAAM,KAGzC,GAA+B,IAA3BM,EAAgBC,OAClB,MAAM,IAAIC,8BAA8BJ,GAG1C,IAAKK,EAA0CH,KAAhCI,EAAgCJ,EAAtBK,GAAAA,EAAsBL,EAAe,GAA3BM,EAAYN,EAG/CK,GAKA,OALAA,EAAWA,EAASE,SAAS,EAAG,KAKzB,CACLJ,SAHFA,EAAWA,EAASI,SAAS,EAAG,KAI9BH,SAAUA,EACVC,SAAUA,EACVC,SAAUA,EAEd,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AnCyB,SACvBb,EACAC,GACmB9B,OAAAA,QAAAC,QACD2B,EAAgBC,EAAKC,IAAIzB,KAArCoC,SAAAA,GAAGM,SAAAA,IAWT,ODSkC,SAClCxC,EACAyC,GAEA,IACMC,EApBsB,SAAC1C,EAAkB2C,GAC/C,IAAMrC,EAAaN,EAAQ2C,GAC3B,IAAKrC,EACH,MAAM,IAAII,MAAK,aAAciC,EAAoB,cAInD,OADS,GAAMrC,EAAWM,SAAWN,EAAWQ,UACrCP,QAAQ,KAAM,GAC3B,CAYmBqC,CAAsB5C,EAD5ByC,EAAeJ,QAG1B,SADoBK,EAAWD,EAAeI,MAEhD,CCjBSC,CAA4B9C,EAASoC,EAAS,CAVrD,IAAQA,EAAYF,EAAZE,QACR,IAAKA,IAAYA,EAAQC,OACvB,MAAM,IAAI3B,MAAM,oBACjB,IAAAqC,EAAA,WAAA,IAGI/C,EAAOP,OAAAA,QAAAC,QACMF,KAAYM,cAAAkD,GAA5BhD,EAAOgD,CAAsB,EAAA,CAJ9B,GAI8B,OAAAD,GAAAA,EAAAjD,KAAAiD,EAAAjD,KAAA0C,GAAAA,GAAA,EAIjC,kBCpEM,SAAuBS,GAAqC,IACV,OAAAxD,QAAAC,QAC/BC,EAAAA,QAAMC,IADd4B,yDACuB,CACpC3B,aAAc,OACd6B,OAAQ,CACNuB,EAAAA,MAEFnD,cALIC,GAQN,OADYA,EAASmB,IACV,EACb,CAAC,MAAAC,GAAA,OAAA1B,QAAA2B,OAAAD,EAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../src/muni.ts","../src/m_reverse_geocode.ts","../src/msearch.ts"],"sourcesContent":["// Muni file url\nconst MuniURL = 'https://maps.gsi.go.jp/js/muni.js';\nconst MuniRegex = /GSI\\.MUNI_ARRAY\\[\"\\d+\"\\]\\s*=\\s*'(.*?)';/g;\n\nimport axios from 'axios';\nimport { AddressResults, MuniMap } from './types';\n\n/**\n * parse muni.js\n * @param muniMap\n */\nconst parseMuniMap = (muniMap: string) => {\n const muniMapObj: MuniMap = {};\n const lines = muniMap.split('\\n');\n lines.forEach((line) => {\n if (MuniRegex.test(line)) {\n const muniRecord = parseMuniRecord(line);\n muniMapObj[muniRecord.cityCode] = muniRecord;\n }\n });\n return muniMapObj;\n};\n\n/**\n * parse muni record\n * @param line\n */\nconst parseMuniRecord = (line: string) => {\n const muniRecord = line.replace(MuniRegex, '$1');\n\n const muniRecordArray = muniRecord.split(',');\n\n // validate muni record\n if (muniRecordArray.length !== 4) {\n throw new Error(`invalid muni record: ${muniRecord}`);\n }\n\n let [prefCode, prefName, cityCode, cityName] = muniRecordArray;\n\n // if cityCode is not 5 digits, add 0 to the beginning\n cityCode = cityCode.padStart(5, '0');\n\n // if prefCode is not 2 digits, add 0 to the beginning\n prefCode = prefCode.padStart(2, '0');\n\n return {\n prefCode: prefCode,\n prefName: prefName,\n cityCode: cityCode,\n cityName: cityName,\n };\n};\n\n/**\n * Get muni map (city or ward map by city code) from GSI\n */\nconst getMuniMap = async () => {\n const response = await axios.get(MuniURL, {\n responseType: 'text',\n });\n\n const muniMap = response.data;\n return parseMuniMap(muniMap);\n};\n\n/**\n * converts muni code to address name.\n *\n * @param muniMap\n * @param muniCode\n */\nconst muniCodeToAddressName = (muniMap: MuniMap, muniCode: string) => {\n const muniRecord = muniMap[muniCode];\n if (!muniRecord) {\n throw new Error(`muni code ${muniCode} not found`);\n }\n\n const add = `${muniRecord.prefName}${muniRecord.cityName}`;\n return add.replace(/ /g, '');\n};\n\n/**\n * converts address result to address name.\n * @param muniMap\n * @param addressResults\n */\nconst addressResultsToAddressName = (\n muniMap: MuniMap,\n addressResults: AddressResults\n) => {\n const mc = addressResults.muniCd;\n const muniName = muniCodeToAddressName(muniMap, mc);\n const addrName = `${muniName}${addressResults.lv01Nm}`;\n return addrName;\n};\n\nconst getMuniMapLocations = async () => {\n const muniMap = await getMuniMap();\n // muniMap is a map of all cities and wards in Japan\n // key: city code, value: { prefCode, prefName, cityCode, cityName }\n // we need to convert this to a map of all locations in Japan\n // key: prefCode , value: { prefName, cities: { key: cityCode, value: { cityCode, cityName, wards: { key: wardCode, value: { wardCode, wardName } } } } }\n\n const muniMapLocations = {};\n Object.keys(muniMap).forEach((cityCode) => {\n const muniRecord = muniMap[cityCode];\n const { prefCode, prefName, cityName } = muniRecord;\n if (!muniMapLocations[prefCode]) {\n muniMapLocations[prefCode] = { prefName, cities: {} };\n }\n\n // if cityName contains ' ', it is a ward\n // otherwise, it is a city\n if (cityName.includes(' ')) {\n // ward name is after ' '\n const [name, wardName] = cityName.split(' ');\n // find city has the same name\n const city: any = Object.values(muniMap).find(\n (c: any) => c.cityName === name\n );\n if (!city) {\n console.log(`City ${name} not found in prefCode ${prefCode}`);\n } else {\n // add ward to city\n muniMapLocations[prefCode].cities[city.cityCode].wards[cityCode] = {\n prefCode,\n cityCode: cityCode,\n cityName: `${name}${wardName}`,\n bigCityFlag: '1',\n bigCityCode: city.cityCode,\n };\n }\n } else {\n muniMapLocations[prefCode].cities[cityCode] = {\n prefCode,\n cityCode,\n cityName,\n wards: {},\n };\n }\n });\n\n // assign bigCityFlag to each city\n Object.keys(muniMapLocations).forEach((prefCode) => {\n const pref = muniMapLocations[prefCode];\n Object.keys(pref.cities).forEach((cityCode) => {\n const city = pref.cities[cityCode];\n const isBigCity = Object.values(city.wards).length > 0;\n if (isBigCity) {\n city.bigCityFlag = '2';\n } else {\n // delete wards\n delete city.wards;\n // if city is tokyo then bigCityFlag is 3, otherwise 0\n if (city.prefCode === '13') {\n city.bigCityFlag = '3';\n } else {\n city.bigCityFlag = '0';\n }\n }\n });\n });\n\n return muniMapLocations;\n};\n\nexport {\n getMuniMap,\n getMuniMapLocations,\n muniCodeToAddressName,\n addressResultsToAddressName,\n};\n","import axios from 'axios';\n\nimport { ReverseGeocodeResults, MuniMap, MuniRecord } from './types';\nimport { addressResultsToAddressName, getMuniMap } from './muni';\nconst BaseURL = 'https://mreversegeocoder.gsi.go.jp';\n\n// cache muni map\nvar muniMap: MuniMap | null = null;\n\n/**\n * reverse geocoding by latitude and longitude to address\n * It returns town name only\n *\n * @param lat\n * @param lon\n * @returns address\n */\nconst latLonToAddress = async (\n lat: number,\n lon: number\n): Promise<ReverseGeocodeResults> => {\n try {\n const url = `${BaseURL}/reverse-geocoder/LonLatToAddress`;\n const response = await axios.get(url, {\n timeout: 500, // Timeout after 5 seconds\n responseType: 'json',\n params: {\n lat,\n lon,\n },\n });\n\n // if status is not 200\n if (response.status !== 200) {\n console.log(\"response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n }\n\n const res = response.data;\n return res;\n } catch (error: any) {\n // if it is axios error\n if (error.response) {\n console.log(\"error.response\");\n const err = new Error('Failed to get address. status is not 200');\n err.name = 'API_ERROR';\n throw err;\n } else {\n console.log(\"error\");\n throw error;\n }\n }\n};\n\n/**\n * Get full address name by latitude and longitude\n * @param lat\n * @param lon\n * @returns prefecture + city + town\n */\nconst latLonToAddressName = async (\n lat: number,\n lon: number\n): Promise<string> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n muniMap = await getMuniMap();\n }\n\n return addressResultsToAddressName(muniMap, results);\n};\n\nconst latLonToAddressInfo = async (\n lat: number,\n lon: number\n): Promise<MuniRecord> => {\n const res = await latLonToAddress(lat, lon);\n const { results } = res;\n if (!results || !results.muniCd) {\n throw new Error('No address found');\n }\n\n // update muniMap\n if (!muniMap) {\n console.log('getMuniMap');\n muniMap = await getMuniMap();\n }\n const mc = results.muniCd;\n return muniMap[mc];\n};\n\nexport {\n latLonToAddressInfo,\n getMuniMap,\n latLonToAddress,\n latLonToAddressName,\n};\n","import axios from 'axios';\n\nimport { SearchResults } from './types';\n\n// base url for msearch api\nconst BaseURL = 'https://msearch.gsi.go.jp';\n\n/**\n * search address by query\n */\nconst searchAddress = async (q: string): Promise<SearchResults> => {\n const url = `${BaseURL}/address-search/AddressSearch`;\n const response = await axios.get(url, {\n responseType: 'json',\n params: {\n q,\n },\n });\n\n const res = response.data;\n return res;\n};\n\nexport { searchAddress };\n"],"names":["MuniRegex","getMuniMap","Promise","resolve","axios","get","responseType","then","response","muniMap","muniMapObj","split","forEach","line","test","muniRecord","replace","muniRecordArray","length","Error","prefCode","prefName","cityCode","cityName","padStart","parseMuniRecord","parseMuniMap","data","e","reject","latLonToAddress","lat","lon","BaseURL","timeout","params","status","console","log","err","name","_catch","error","res","_temp4","results","muniCd","_temp3","_getMuniMap2","_temp2","addressResults","muniName","muniCode","muniCodeToAddressName","lv01Nm","addressResultsToAddressName","_temp","_getMuniMap","q"],"mappings":"2WAEMA,EAAY,2CAsDZC,EAAU,eAAcC,OAAAA,QAAAC,QACLC,UAAMC,IAxDf,oCAwD4B,CACxCC,aAAc,UACdC,cAFIC,GAKN,OAnDmB,SAACC,GACpB,IAAMC,EAAsB,CAAA,EAQ5B,OAPcD,EAAQE,MAAM,MACtBC,QAAQ,SAACC,GACb,GAAIb,EAAUc,KAAKD,GAAO,CACxB,IAAME,EAWY,SAACF,GACvB,IAAME,EAAaF,EAAKG,QAAQhB,EAAW,MAErCiB,EAAkBF,EAAWJ,MAAM,KAGzC,GAA+B,IAA3BM,EAAgBC,OAClB,MAAM,IAAIC,8BAA8BJ,GAG1C,IAAKK,EAA0CH,KAAhCI,EAAgCJ,EAAtBK,GAAAA,EAAsBL,EAAe,GAA3BM,EAAYN,EAG/CK,GAKA,OALAA,EAAWA,EAASE,SAAS,EAAG,KAKzB,CACLJ,SAHFA,EAAWA,EAASI,SAAS,EAAG,KAI9BH,SAAUA,EACVC,SAAUA,EACVC,SAAUA,EAEd,CAnCyBE,CAAgBZ,GACnCH,EAAWK,EAAWO,UAAYP,CACnC,CACH,GACOL,CACT,CAyCSgB,CADSlB,EAASmB,KACI,EAC/B,CAAC,MAAAC,GAAA1B,OAAAA,QAAA2B,OAAAD,EAQD,CAAA,EChEInB,EAA0B,KAUxBq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C,EAAaN,EAAQ2C,GAC3B,IAAKrC,EACH,MAAM,IAAII,MAAK,aAAciC,EAAoB,cAInD,OADS,GAAMrC,EAAWM,SAAWN,EAAWQ,UACrCP,QAAQ,KAAM,GAC3B,CAYmBqC,CAAsB5C,EAD5ByC,EAAeJ,QAG1B,SADoBK,EAAWD,EAAeI,MAEhD,CCjBSC,CAA4B9C,EAASoC,EAAS,CAVrD,IAAQA,EAAYF,EAAZE,QACR,IAAKA,IAAYA,EAAQC,OACvB,MAAM,IAAI3B,MAAM,oBACjB,IAAAqC,EAAA,WAAA,IAGI/C,EAAOP,OAAAA,QAAAC,QACMF,KAAYM,cAAAkD,GAA5BhD,EAAOgD,CAAsB,EAAA,CAJ9B,GAI8B,OAAAD,GAAAA,EAAAjD,KAAAiD,EAAAjD,KAAA0C,GAAAA,GAAA,EAIjC,kBCpEM,SAAuBS,GAAqC,IACV,OAAAxD,QAAAC,QAC/BC,EAAAA,QAAMC,IADd4B,yDACuB,CACpC3B,aAAc,OACd6B,OAAQ,CACNuB,EAAAA,MAEFnD,cALIC,GAQN,OADYA,EAASmB,IACV,EACb,CAAC,MAAAC,GAAA,OAAA1B,QAAA2B,OAAAD,EAAA,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sk-global/js-msearch-gsi-jp",
|
|
3
3
|
"description": "A client library for APIs that presented by Geospatial Information Authority of Japan",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.15",
|
|
5
5
|
"source": "src/index.ts",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.module.js",
|