mirror of
https://github.com/jlengrand/leaflet-geosearch.git
synced 2026-03-10 08:31:26 +00:00
update docs
This commit is contained in:
@@ -0,0 +1 @@
|
||||
{"code":"import OpenStreetMapProvider from './openStreetMapProvider';\r\nexport default class LocationIQProvider extends OpenStreetMapProvider {\r\n constructor(options) {\r\n super({\r\n ...options,\r\n searchUrl: `https://locationiq.org/v1/search.php`,\r\n reverseUrl: `https://locationiq.org/v1/reverse.php`,\r\n });\r\n }\r\n}\r\n//# sourceMappingURL=locationIQProvider.js.map","map":"{\"version\":3,\"file\":\"locationIQProvider.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/providers/locationIQProvider.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,qBAAuD,MAAM,yBAAyB,CAAC;AAE9F,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,qBAAqB;IACnE,YAAY,OAAqC;QAC/C,KAAK,CAAC;YACJ,GAAG,OAAO;YACV,SAAS,EAAE,sCAAsC;YACjD,UAAU,EAAE,uCAAuC;SACpD,CAAC,CAAC;IACL,CAAC;CACF\"}","dts":{"name":"/home/smeijer/dev/leaflet-geosearch/src/providers/locationIQProvider.d.ts","writeByteOrderMark":false,"text":"import OpenStreetMapProvider, { OpenStreetMapProviderOptions } from './openStreetMapProvider';\r\nexport default class LocationIQProvider extends OpenStreetMapProvider {\r\n constructor(options: OpenStreetMapProviderOptions);\r\n}\r\n"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"code":"export var RequestType;\r\n(function (RequestType) {\r\n RequestType[RequestType[\"SEARCH\"] = 0] = \"SEARCH\";\r\n RequestType[RequestType[\"REVERSE\"] = 1] = \"REVERSE\";\r\n})(RequestType || (RequestType = {}));\r\nexport default class AbstractProvider {\r\n constructor(options = {}) {\r\n this.options = options;\r\n }\r\n getParamString(params = {}) {\r\n const set = { ...this.options.params, ...params };\r\n return Object.keys(set)\r\n .map((key) => `${encodeURIComponent(key)}=${encodeURIComponent(set[key])}`)\r\n .join('&');\r\n }\r\n getUrl(url, params) {\r\n return `${url}?${this.getParamString(params)}`;\r\n }\r\n async search(options) {\r\n const url = this.endpoint({\r\n query: options.query,\r\n type: RequestType.SEARCH,\r\n });\r\n const request = await fetch(url);\r\n const json = await request.json();\r\n return this.parse({ data: json });\r\n }\r\n}\r\n//# sourceMappingURL=provider.js.map","map":"{\"version\":3,\"file\":\"provider.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/providers/provider.ts\"],\"names\":[],\"mappings\":\"AAwBA,MAAM,CAAN,IAAY,WAGX;AAHD,WAAY,WAAW;IACrB,iDAAM,CAAA;IACN,mDAAO,CAAA;AACT,CAAC,EAHW,WAAW,KAAX,WAAW,QAGtB;AAwBD,MAAM,CAAC,OAAO,OAAgB,gBAAgB;IAI5C,YAAY,UAA2B,EAAE;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;IAKD,cAAc,CAAC,SAAyB,EAAE;QACxC,MAAM,GAAG,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;QAClD,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;aACpB,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,kBAAkB,CAAC,GAAG,CAAC,IAAI,kBAAkB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;aAC1E,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,CAAC;IAED,MAAM,CAAC,GAAW,EAAE,MAAuB;QACzC,OAAO,GAAG,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,CAAC;IACjD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,OAAuB;QAClC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC;YACxB,KAAK,EAAE,OAAO,CAAC,KAAK;YACpB,IAAI,EAAE,WAAW,CAAC,MAAM;SACzB,CAAC,CAAC;QAEH,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,MAAM,IAAI,GAAmB,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;QAClD,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,CAAC;CACF\"}","dts":{"name":"/home/smeijer/dev/leaflet-geosearch/src/providers/provider.d.ts","writeByteOrderMark":false,"text":"export declare type PointTuple = [number, number];\r\nexport declare type BoundsTuple = [PointTuple, PointTuple];\r\nexport interface LatLng {\r\n lat: number;\r\n lng: number;\r\n}\r\nexport interface SearchResult<TRawResult> {\r\n x: number;\r\n y: number;\r\n label: string;\r\n bounds: BoundsTuple;\r\n raw: TRawResult;\r\n}\r\nexport interface ProviderParams {\r\n [key: string]: string | number | boolean;\r\n}\r\nexport interface ProviderOptions {\r\n params?: ProviderParams;\r\n}\r\nexport declare enum RequestType {\r\n SEARCH = 0,\r\n REVERSE = 1\r\n}\r\nexport interface EndpointArgument {\r\n query: string | {\r\n [key: string]: string | number | boolean;\r\n };\r\n type?: RequestType;\r\n}\r\nexport interface SearchArgument {\r\n query: string;\r\n}\r\nexport interface ParseArgument<TData> {\r\n data: TData;\r\n}\r\nexport interface Provider<TRequestResult, TRawResult> {\r\n options: ProviderOptions;\r\n endpoint(options: EndpointArgument): string;\r\n getParamString(params: ProviderParams): string;\r\n parse(response: ParseArgument<TRequestResult>): SearchResult<TRawResult>[];\r\n search(options: SearchArgument): Promise<SearchResult<TRawResult>[]>;\r\n}\r\nexport default abstract class AbstractProvider<TRequestResult, TRawResult> implements Provider<TRequestResult, TRawResult> {\r\n options: ProviderOptions;\r\n constructor(options?: ProviderOptions);\r\n abstract endpoint(options: EndpointArgument): string;\r\n abstract parse(response: ParseArgument<TRequestResult>): SearchResult<TRawResult>[];\r\n getParamString(params?: ProviderParams): string;\r\n getUrl(url: string, params?: ProviderParams): string;\r\n search(options: SearchArgument): Promise<SearchResult<TRawResult>[]>;\r\n}\r\n"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"code":"import AbstractProvider from './provider';\r\nimport { createScriptElement } from '../domUtils';\r\nexport default class BingProvider extends AbstractProvider {\r\n constructor() {\r\n super(...arguments);\r\n this.searchUrl = 'https://dev.virtualearth.net/REST/v1/Locations';\r\n }\r\n endpoint({ query, jsonp }) {\r\n const params = typeof query === 'string' ? { q: query } : query;\r\n params.jsonp = jsonp;\r\n return this.getUrl(this.searchUrl, params);\r\n }\r\n parse(response) {\r\n if (response.data.resourceSets.length === 0) {\r\n return [];\r\n }\r\n return response.data.resourceSets[0].resources.map((r) => ({\r\n x: r.point.coordinates[1],\r\n y: r.point.coordinates[0],\r\n label: r.address.formattedAddress,\r\n bounds: [\r\n [r.bbox[0], r.bbox[1]],\r\n [r.bbox[2], r.bbox[3]],\r\n ],\r\n raw: r,\r\n }));\r\n }\r\n async search({ query }) {\r\n const jsonp = `BING_JSONP_CB_${Date.now()}`;\r\n const json = await createScriptElement(this.endpoint({ query, jsonp }), jsonp);\r\n return this.parse({ data: json });\r\n }\r\n}\r\n//# sourceMappingURL=bingProvider.js.map","map":"{\"version\":3,\"file\":\"bingProvider.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/providers/bingProvider.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,gBAAmF,MAAM,YAAY,CAAC;AAC7G,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAwClD,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAA0C;IAApF;;QACE,cAAS,GAAG,gDAAgD,CAAC;IAgC/D,CAAC;IA9BC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,EAAwC;QAC7D,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAChE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAErB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,QAAsC;QAC1C,IAAI,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,KAAK,CAAC,EAAE;YAC3C,OAAO,EAAE,CAAC;SACX;QAED,OAAO,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACzD,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;YACzB,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,CAAC;YACzB,KAAK,EAAE,CAAC,CAAC,OAAO,CAAC,gBAAgB;YACjC,MAAM,EAAE;gBACN,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;gBACtB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;aACvB;YACD,GAAG,EAAE,CAAC;SACP,CAAC,CAAC,CAAC;IACN,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAE,KAAK,EAAkB;QACpC,MAAM,KAAK,GAAG,iBAAiB,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QAC5C,MAAM,IAAI,GAAG,MAAM,mBAAmB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,CAAC,CAAC;QAE/E,OAAO,IAAI,CAAC,KAAK,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;IACpC,CAAC;CACF\"}","dts":{"name":"/home/smeijer/dev/leaflet-geosearch/src/providers/bingProvider.d.ts","writeByteOrderMark":false,"text":"import AbstractProvider, { EndpointArgument, ParseArgument, SearchArgument, SearchResult } from './provider';\r\nexport interface RequestResult {\r\n authenticationResultCode: string;\r\n brandLogoUri: string;\r\n copyright: string;\r\n resourceSets: {\r\n estimatedTotal: number;\r\n resources: RawResult[];\r\n }[];\r\n statusCode: number;\r\n statusDescription: string;\r\n traceId: string;\r\n}\r\nexport interface RawResult {\r\n __type: string;\r\n bbox: [number, number, number, number];\r\n name: string;\r\n point: {\r\n type: 'Point';\r\n coordinates: [number, number];\r\n };\r\n address: {\r\n adminDistrict: string;\r\n adminDistrict2: string;\r\n countryRegion: string;\r\n formattedAddress: string;\r\n locality: string;\r\n };\r\n confidence: string;\r\n entityType: string;\r\n geocodePoints: [{\r\n type: 'Point';\r\n coordinates: [number, number];\r\n calculationMethod: string;\r\n usageTypes: string[];\r\n }];\r\n matchCodes: string[];\r\n}\r\nexport default class BingProvider extends AbstractProvider<RequestResult, RawResult> {\r\n searchUrl: string;\r\n endpoint({ query, jsonp }: EndpointArgument & {\r\n jsonp: string;\r\n }): string;\r\n parse(response: ParseArgument<RequestResult>): SearchResult<RawResult>[];\r\n search({ query }: SearchArgument): Promise<SearchResult<RawResult>[]>;\r\n}\r\n"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"code":"import AbstractProvider from './provider';\r\nexport default class GoogleProvider extends AbstractProvider {\r\n constructor() {\r\n super(...arguments);\r\n this.searchUrl = 'https://maps.googleapis.com/maps/api/geocode/json';\r\n }\r\n endpoint({ query }) {\r\n const params = typeof query === 'string' ? { address: query } : query;\r\n return this.getUrl(this.searchUrl, params);\r\n }\r\n parse(result) {\r\n return result.data.results.map((r) => ({\r\n x: r.geometry.location.lng,\r\n y: r.geometry.location.lat,\r\n label: r.formatted_address,\r\n bounds: [\r\n [r.geometry.viewport.southwest.lat, r.geometry.viewport.southwest.lng],\r\n [r.geometry.viewport.northeast.lat, r.geometry.viewport.northeast.lng],\r\n ],\r\n raw: r,\r\n }));\r\n }\r\n}\r\n//# sourceMappingURL=googleProvider.js.map","map":"{\"version\":3,\"file\":\"googleProvider.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/providers/googleProvider.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,gBAA2E,MAAM,YAAY,CAAC;AA8BrG,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,gBAA0C;IAAtF;;QACE,cAAS,GAAG,mDAAmD,CAAC;IAmBlE,CAAC;IAjBC,QAAQ,CAAC,EAAE,KAAK,EAAoB;QAClC,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QACtE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,MAAoC;QACxC,OAAO,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACrC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG;YAC1B,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG;YAC1B,KAAK,EAAE,CAAC,CAAC,iBAAiB;YAC1B,MAAM,EAAE;gBACN,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;gBACtE,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC;aACvE;YACD,GAAG,EAAE,CAAC;SACP,CAAC,CAAC,CAAC;IACN,CAAC;CACF\"}","dts":{"name":"/home/smeijer/dev/leaflet-geosearch/src/providers/googleProvider.d.ts","writeByteOrderMark":false,"text":"import AbstractProvider, { EndpointArgument, LatLng, ParseArgument, SearchResult } from './provider';\r\nexport interface RequestResult {\r\n results: RawResult[];\r\n status: string;\r\n}\r\nexport interface RawResult {\r\n address_components: {\r\n long_name: string;\r\n short_name: string;\r\n types: string[];\r\n }[];\r\n formatted_address: string;\r\n geometry: {\r\n location: LatLng;\r\n location_type: string;\r\n viewport: {\r\n northeast: LatLng;\r\n southwest: LatLng;\r\n };\r\n };\r\n place_id: string;\r\n plus_code: {\r\n compound_code: string;\r\n global_code: string;\r\n };\r\n types: string[];\r\n}\r\nexport default class GoogleProvider extends AbstractProvider<RequestResult, RawResult> {\r\n searchUrl: string;\r\n endpoint({ query }: EndpointArgument): string;\r\n parse(result: ParseArgument<RequestResult>): SearchResult<RawResult>[];\r\n}\r\n"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"code":"import AbstractProvider from './provider';\r\nexport default class OpenCageProvider extends AbstractProvider {\r\n constructor() {\r\n super(...arguments);\r\n this.searchUrl = 'https://api.opencagedata.com/geocode/v1/json';\r\n }\r\n endpoint({ query }) {\r\n const params = typeof query === 'string' ? { q: query } : query;\r\n params.format = 'json';\r\n return this.getUrl(this.searchUrl, params);\r\n }\r\n parse(response) {\r\n return response.data.results.map((r) => ({\r\n x: r.geometry.lng,\r\n y: r.geometry.lat,\r\n label: r.formatted,\r\n bounds: [\r\n [r.bounds.southwest.lat, r.bounds.southwest.lng],\r\n [r.bounds.northeast.lat, r.bounds.northeast.lng],\r\n ],\r\n raw: r,\r\n }));\r\n }\r\n}\r\n//# sourceMappingURL=openCageProvider.js.map","map":"{\"version\":3,\"file\":\"openCageProvider.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/providers/openCageProvider.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,gBAA2E,MAAM,YAAY,CAAC;AAkErG,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,gBAA0C;IAAxF;;QACE,cAAS,GAAG,8CAA8C,CAAC;IAqB7D,CAAC;IAnBC,QAAQ,CAAC,EAAE,KAAK,EAAoB;QAClC,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAChE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QAEvB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,QAAsC;QAC1C,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG;YACjB,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,GAAG;YACjB,KAAK,EAAE,CAAC,CAAC,SAAS;YAClB,MAAM,EAAE;gBACN,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC;gBAChD,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC;aACjD;YACD,GAAG,EAAE,CAAC;SACP,CAAC,CAAC,CAAC;IACN,CAAC;CACF\"}","dts":{"name":"/home/smeijer/dev/leaflet-geosearch/src/providers/openCageProvider.d.ts","writeByteOrderMark":false,"text":"import AbstractProvider, { EndpointArgument, LatLng, ParseArgument, SearchResult } from './provider';\r\nexport interface RequestResult {\r\n results: RawResult[];\r\n}\r\nexport interface RawResult {\r\n annotations: {\r\n DMS: {\r\n lat: string;\r\n lng: string;\r\n };\r\n MGRS: string;\r\n Maidenhead: string;\r\n Mercator: {\r\n x: number;\r\n y: number;\r\n };\r\n OSM: {\r\n edit_url: string;\r\n note_url: string;\r\n url: string;\r\n };\r\n UN_M49: {\r\n regions: {\r\n [key: string]: string;\r\n };\r\n statistical_groupings: string[];\r\n };\r\n callingcode: number;\r\n currency: {\r\n alternate_symbols: string[];\r\n decimal_mark: string;\r\n html_entity: string;\r\n iso_code: string;\r\n iso_numeric: string;\r\n name: string;\r\n smallest_denomination: number;\r\n subunit: string;\r\n subunit_to_unit: number;\r\n symbol: string;\r\n symbol_first: number;\r\n thousands_separator: string;\r\n };\r\n flag: string;\r\n geohash: string;\r\n qibla: number;\r\n roadinfo: {\r\n drive_on: string;\r\n road: string;\r\n road_type: string;\r\n speed_in: string;\r\n };\r\n sun: {\r\n rise: {\r\n apparent: number;\r\n astronomical: number;\r\n civil: number;\r\n nautical: number;\r\n };\r\n set: {\r\n apparent: number;\r\n astronomical: number;\r\n civil: number;\r\n nautical: number;\r\n };\r\n };\r\n timezone: {\r\n name: string;\r\n now_in_dst: number;\r\n offset_sec: number;\r\n offset_string: string;\r\n short_name: string;\r\n };\r\n what3words: {\r\n words: string;\r\n };\r\n };\r\n bounds: {\r\n northeast: LatLng;\r\n southwest: LatLng;\r\n };\r\n formatted: string;\r\n geometry: LatLng;\r\n}\r\nexport default class OpenCageProvider extends AbstractProvider<RequestResult, RawResult> {\r\n searchUrl: string;\r\n endpoint({ query }: EndpointArgument): string;\r\n parse(response: ParseArgument<RequestResult>): SearchResult<RawResult>[];\r\n}\r\n"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"code":"/* eslint-disable @typescript-eslint/camelcase */\r\nimport AbstractProvider, { RequestType, } from './provider';\r\nexport default class OpenStreetMapProvider extends AbstractProvider {\r\n constructor(options = {}) {\r\n super(options);\r\n this.searchUrl = options.searchUrl || 'https://nominatim.openstreetmap.org/search';\r\n this.reverseUrl = options.reverseUrl || 'https://nominatim.openstreetmap.org/reverse';\r\n }\r\n endpoint({ query, type }) {\r\n const params = typeof query === 'string' ? { q: query } : query;\r\n params.format = 'json';\r\n switch (type) {\r\n case RequestType.REVERSE:\r\n return this.getUrl(this.reverseUrl, params);\r\n default:\r\n return this.getUrl(this.searchUrl, params);\r\n }\r\n }\r\n parse(response) {\r\n const records = Array.isArray(response.data) ? response.data : [response.data];\r\n return records.map((r) => ({\r\n x: Number(r.lon),\r\n y: Number(r.lat),\r\n label: r.display_name,\r\n bounds: [\r\n [parseFloat(r.boundingbox[0]), parseFloat(r.boundingbox[2])],\r\n [parseFloat(r.boundingbox[1]), parseFloat(r.boundingbox[3])],\r\n ],\r\n raw: r,\r\n }));\r\n }\r\n}\r\n//# sourceMappingURL=openStreetMapProvider.js.map","map":"{\"version\":3,\"file\":\"openStreetMapProvider.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/providers/openStreetMapProvider.ts\"],\"names\":[],\"mappings\":\"AAAA,iDAAiD;AACjD,OAAO,gBAAgB,EAAE,EAIvB,WAAW,GAEZ,MAAM,YAAY,CAAC;AAyBpB,MAAM,CAAC,OAAO,OAAO,qBAAsB,SAAQ,gBAAwC;IAIzF,YAAY,UAAwC,EAAE;QACpD,KAAK,CAAC,OAAO,CAAC,CAAC;QAEf,IAAI,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,IAAI,4CAA4C,CAAC;QACnF,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,6CAA6C,CAAC;IACxF,CAAC;IAED,QAAQ,CAAC,EAAE,KAAK,EAAE,IAAI,EAAoB;QACxC,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QAChE,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QAEvB,QAAQ,IAAI,EAAE;YACZ,KAAK,WAAW,CAAC,OAAO;gBACtB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;YAE9C;gBACE,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;SAC9C;IACH,CAAC;IAED,KAAK,CAAC,QAAsC;QAC1C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QAE/E,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACzB,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;YAChB,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC;YAChB,KAAK,EAAE,CAAC,CAAC,YAAY;YACrB,MAAM,EAAE;gBACN,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;gBAC5D,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC;aAC7D;YACD,GAAG,EAAE,CAAC;SACP,CAAC,CAAC,CAAC;IACN,CAAC;CACF\"}","dts":{"name":"/home/smeijer/dev/leaflet-geosearch/src/providers/openStreetMapProvider.d.ts","writeByteOrderMark":false,"text":"import AbstractProvider, { EndpointArgument, ParseArgument, ProviderOptions, SearchResult } from './provider';\r\nexport declare type RequestResult = RawResult[];\r\nexport interface RawResult {\r\n place_id: string;\r\n license: string;\r\n osm_type: string;\r\n osm_id: number;\r\n boundingbox: [string, string, string, string];\r\n lat: string;\r\n lon: string;\r\n display_name: string;\r\n class: string;\r\n type: string;\r\n importance: number;\r\n icon?: string;\r\n}\r\nexport declare type OpenStreetMapProviderOptions = {\r\n searchUrl?: string;\r\n reverseUrl?: string;\r\n} & ProviderOptions;\r\nexport default class OpenStreetMapProvider extends AbstractProvider<RawResult[], RawResult> {\r\n searchUrl: string;\r\n reverseUrl: string;\r\n constructor(options?: OpenStreetMapProviderOptions);\r\n endpoint({ query, type }: EndpointArgument): string;\r\n parse(response: ParseArgument<RequestResult>): SearchResult<RawResult>[];\r\n}\r\n"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"code":"/* eslint-disable @typescript-eslint/no-explicit-any */\r\nexport default function debounce(cb, wait = 250, immediate = false) {\r\n let timeout;\r\n return (...args) => {\r\n if (timeout) {\r\n clearTimeout(timeout);\r\n }\r\n timeout = setTimeout(() => {\r\n timeout = null;\r\n if (!immediate) {\r\n cb(...args);\r\n }\r\n }, wait);\r\n if (immediate && !timeout) {\r\n cb(...args);\r\n }\r\n };\r\n}\r\n//# sourceMappingURL=debounce.js.map","map":"{\"version\":3,\"file\":\"debounce.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/lib/debounce.ts\"],\"names\":[],\"mappings\":\"AAAA,uDAAuD;AACvD,MAAM,CAAC,OAAO,UAAU,QAAQ,CAC9B,EAA4B,EAC5B,IAAI,GAAG,GAAG,EACV,SAAS,GAAG,KAAK;IAEjB,IAAI,OAA6C,CAAC;IAElD,OAAO,CAAC,GAAG,IAAW,EAAQ,EAAE;QAC9B,IAAI,OAAO,EAAE;YACX,YAAY,CAAC,OAAO,CAAC,CAAC;SACvB;QAED,OAAO,GAAG,UAAU,CAAC,GAAG,EAAE;YACxB,OAAO,GAAG,IAAI,CAAC;YAEf,IAAI,CAAC,SAAS,EAAE;gBACd,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;aACb;QACH,CAAC,EAAE,IAAI,CAAC,CAAC;QAET,IAAI,SAAS,IAAI,CAAC,OAAO,EAAE;YACzB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;SACb;IACH,CAAC,CAAC;AACJ,CAAC\"}","dts":{"name":"/home/smeijer/dev/leaflet-geosearch/src/lib/debounce.d.ts","writeByteOrderMark":false,"text":"export default function debounce(cb: (...args: any[]) => void, wait?: number, immediate?: boolean): (...args: any[]) => void;\r\n"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"code":"import AbstractProvider from './provider';\r\nexport default class EsriProvider extends AbstractProvider {\r\n constructor() {\r\n super(...arguments);\r\n this.searchUrl = 'https://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find';\r\n }\r\n endpoint({ query }) {\r\n const params = typeof query === 'string' ? { text: query } : query;\r\n params.f = 'json';\r\n return this.getUrl(this.searchUrl, params);\r\n }\r\n parse(result) {\r\n return result.data.locations.map((r) => ({\r\n x: r.feature.geometry.x,\r\n y: r.feature.geometry.y,\r\n label: r.name,\r\n bounds: [\r\n [r.extent.ymin, r.extent.xmin],\r\n [r.extent.ymax, r.extent.xmax],\r\n ],\r\n raw: r,\r\n }));\r\n }\r\n}\r\n//# sourceMappingURL=esriProvider.js.map","map":"{\"version\":3,\"file\":\"esriProvider.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../../src/providers/esriProvider.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,gBAAmE,MAAM,YAAY,CAAC;AAqB7F,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,gBAA0C;IAApF;;QACE,cAAS,GAAG,0EAA0E,CAAC;IAqBzF,CAAC;IAnBC,QAAQ,CAAC,EAAE,KAAK,EAAoB;QAClC,MAAM,MAAM,GAAG,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;QACnE,MAAM,CAAC,CAAC,GAAG,MAAM,CAAC;QAElB,OAAO,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC;IAED,KAAK,CAAC,MAAoC;QACxC,OAAO,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACvC,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACvB,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YACvB,KAAK,EAAE,CAAC,CAAC,IAAI;YACb,MAAM,EAAE;gBACN,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;gBAC9B,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC;aAC/B;YACD,GAAG,EAAE,CAAC;SACP,CAAC,CAAC,CAAC;IACN,CAAC;CACF\"}","dts":{"name":"/home/smeijer/dev/leaflet-geosearch/src/providers/esriProvider.d.ts","writeByteOrderMark":false,"text":"import AbstractProvider, { EndpointArgument, ParseArgument, SearchResult } from './provider';\r\ninterface RequestResult {\r\n spatialReference: {\r\n wkid: number;\r\n latestWkid: number;\r\n };\r\n locations: RawResult[];\r\n}\r\ninterface RawResult {\r\n name: string;\r\n extent: {\r\n xmin: number;\r\n ymin: number;\r\n xmax: number;\r\n ymax: number;\r\n };\r\n feature: {\r\n geometry: {\r\n x: number;\r\n y: number;\r\n };\r\n attributes: {\r\n Score: number;\r\n Addr_Type: string;\r\n };\r\n };\r\n}\r\nexport default class EsriProvider extends AbstractProvider<RequestResult, RawResult> {\r\n searchUrl: string;\r\n endpoint({ query }: EndpointArgument): string;\r\n parse(result: ParseArgument<RequestResult>): SearchResult<RawResult>[];\r\n}\r\nexport {};\r\n"}}
|
||||
@@ -0,0 +1 @@
|
||||
{"code":"export { default as GeoSearchControl } from './leafletControl';\r\nexport { default as SearchElement } from './searchElement';\r\nexport { default as BingProvider } from './providers/bingProvider';\r\nexport { default as EsriProvider } from './providers/esriProvider';\r\nexport { default as GoogleProvider } from './providers/googleProvider';\r\nexport { default as LocationIQProvider } from './providers/locationIQProvider';\r\nexport { default as OpenCageProvider } from './providers/openCageProvider';\r\nexport { default as OpenStreetMapProvider } from './providers/openStreetMapProvider';\r\nexport { default as Provider } from './providers/provider';\r\n//# sourceMappingURL=index.js.map","map":"{\"version\":3,\"file\":\"index.js\",\"sourceRoot\":\"\",\"sources\":[\"../../../src/index.ts\"],\"names\":[],\"mappings\":\"AAAA,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAE3D,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAC/E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAC3E,OAAO,EAAE,OAAO,IAAI,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAErF,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC\"}","dts":{"name":"/home/smeijer/dev/leaflet-geosearch/src/index.d.ts","writeByteOrderMark":false,"text":"export { default as GeoSearchControl } from './leafletControl';\r\nexport { default as SearchElement } from './searchElement';\r\nexport { default as BingProvider } from './providers/bingProvider';\r\nexport { default as EsriProvider } from './providers/esriProvider';\r\nexport { default as GoogleProvider } from './providers/googleProvider';\r\nexport { default as LocationIQProvider } from './providers/locationIQProvider';\r\nexport { default as OpenCageProvider } from './providers/openCageProvider';\r\nexport { default as OpenStreetMapProvider } from './providers/openStreetMapProvider';\r\nexport { default as Provider } from './providers/provider';\r\n"}}
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
@@ -0,0 +1 @@
|
||||
[]
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user