UNPKG

thinkgeocloudclient-js

Version:

A JavaScript library for ThinkGeo Cloud Server.

2 lines 27 kB
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.tg=t():e.tg=t()}(window,(function(){return function(e){var t={};function r(i){if(t[i])return t[i].exports;var o=t[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,r),o.l=!0,o.exports}return r.m=e,r.c=t,r.d=function(e,t,i){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(r.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(i,o,function(t){return e[t]}.bind(null,o));return i},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){"use strict";r.r(t);const i={Meter:"Meter",Feet:"Feet",Kilometer:"Kilometer",Mile:"Mile",UsSurveyFeet:"UsSurveyFeet",Yard:"Yard",NauticalMile:"NauticalMile",Inch:"Inch",Link:"Link",Chain:"Chain",Pole:"Pole",Rod:"Rod",Furlong:"Furlong",Vara:"Vara",Arpent:"Arpent"};Object.freeze(i);var o=i;var n=class{constructor(){this.disposed_=!1}dispose(){this.disposed_||(this.disposed_=!0,this.disposeCore())}disposeCore(){}};var a=class extends n{constructor(){super(),this.listeners_={}}on(e,t){let r=this.listeners_[e];r||(r=this.listeners_[e]=[]),-1===r.indexOf(t)&&r.push(t)}fire(e){const t=this.listeners_[e.type];if(t)for(let r=0;r<t.length;++r)t[r].call(this,e)}un(e,t){const r=this.listeners_[e];if(r){const i=r.indexOf(t);r.splice(i,1),0===r.lengtxlh&&delete this.listeners_[e]}}unAll(){this.listeners_={}}disposeCore(){unAll(this)}};class s{static applyAuthToRequest(e,t,r){return e.forEach(e=>{let i=t[e];switch(i.type){case"basic":if(i.username||i.password){let e=i.username||"",t=i.password||"";r.setHeaderObj.Authorization="Basic "+btoa(`${e}:${t}`)}break;case"apiKey":if(i.apiKey){let e={};i.apiKeyPrefix?e[i.name]=i.apiKeyPrefix+" "+i.apiKey:e[i.name]=i.apiKey,"header"===i.in?r.setHeaderObj["X-API-Key"]=e[i.name]:r.queryObj.apikey=e[i.name]}break;case"oauth2":break;default:throw new Error("Unknown authentication type: "+i.type)}}),r}static paramToString(e){return null==e?"":e instanceof Date?e.toJSON():e.toString()}static buildUrl(e,t,r,i){t.match(/^\//)||(t="/"+t);let o=e+t;o=o.replace(/\{([\w-]+)\}/g,(e,t)=>{let i;return i=r.hasOwnProperty(t)?s.paramToString(r[t]):e,encodeURIComponent(i)});let n="";return Object.keys(i).forEach(e=>{void 0!==i[e]&&null!==i[e]&&""!==i[e]&&(n+=""===n?`?${e}=${i[e]}`:`&${e}=${i[e]}`)}),o+=n,o}static setRequestHeader(e,t){Object.keys(t).forEach((function(r){e.setRequestHeader(r,t[r])}))}static getAccessTokenFromLocalStorage(e){for(let t in e){let r=localStorage.getItem(t);if(void 0===r)throw"Token Item Missing";e[t]=r}}static setAccessTokenToLocalStorage(e){for(let t in e)localStorage.setItem(t,e[t])}static removeAccessTokenFromLocalStorage(e){for(let t in e)localStorage.removeItem(t)}static getLocalStorage(e){return localStorage.getItem(e)}static setLocalStorage(e,t){localStorage.setItem(e,t)}static setCookie(e,t,r){var i=new Date;i.setTime(i.getTime()+1e3*r);var o="expires="+i.toGMTString();document.cookie=e+"="+t+"; "+o}static getCookie(e){for(var t=e+"=",r=document.cookie.split(";"),i=0;i<r.length;i++){var o=r[i].trim();if(0===o.indexOf(t))return o.substring(t.length,o.length)}return""}}var l=s;var u="sendingrequest",c="sentrequest";var p=class{constructor(e,t){this.xhr=e,this.cancel=t,this.type=u}};var d=class{constructor(e){this.xhr=e,this.type=c}};var h=class extends a{constructor(e){super(),this.baseUrls_=["https://cloud1.thinkgeo.com","https://cloud2.thinkgeo.com","https://cloud3.thinkgeo.com","https://cloud4.thinkgeo.com","https://cloud5.thinkgeo.com","https://cloud6.thinkgeo.com"],this.baseUrlIndex_=-1,this.authNames_=[],this.authentications_={"API Key":{type:"apiKey",in:"query",name:"ApiKey"},"Client Credentials":{type:"oauth2"}},e&&(this.authentications_["API Key"].apiKey=e,this.authNames_.push("API Key"))}getNextCandidateBaseUri(){if(this.baseUrlIndex_++,this.baseUrls_){let e=this.baseUrls_.length;return this.baseUrlIndex_>e-1&&(this.baseUrlIndex_=0),this.baseUrls_[this.baseUrlIndex_]}throw new ThinkGeoCloudApplicationException("the urls is empty, please set it in option of client")}callApi(e,t,r,i,o,n,a,s,u){let c={queryObj:i};"post"===t.toLowerCase()&&(c.setHeaderObj={"Content-type":a});let h=void 0===n?this.authNames_:n,g=new XMLHttpRequest;c=l.applyAuthToRequest(h,this.authentications_,c);let m=l.buildUrl(this.getNextCandidateBaseUri(),e,r,c.queryObj);g.open(t,m,!0),c.setHeaderObj&&l.setRequestHeader(g,c.setHeaderObj),s&&("blob"===s.toLowerCase()?g.responseType="blob":"arrayBuffer"===s.toLowerCase()?g.responseType="arrayBuffer":"json"===s.toLowerCase()&&(g.responseType="json"));let y=new p(g);this.fire(y),y.cancel||(u&&(y.xhr.onload=e=>{let t=new d(y.xhr);this.fire(t),u&&u(t.xhr.status,t.xhr.response)},y.xhr.onerror=e=>{u&&u("error",e.type)}),o?y.xhr.send(o):y.xhr.send())}formatResponse(e){return e}disposeCore(){}};var g=class extends h{constructor(e){super(e)}getElevationOfPoint(e,t){let r=e||{},i=r.pointX,o={pointY:r.pointY,pointX:i},n={Srid:r.srid,Proj4String:r.proj4String,ElevationUnit:r.elevationUnit};this.callApi("/api/v1/elevation/{pointY},{pointX}","GET",o,n,void 0,void 0,[],"json",t)}getElevationOfPoints(e,t){let r=e||{},i={Srid:r.srid,Proj4String:r.proj4String,ElevationUnit:r.elevationUnit},o=JSON.stringify(r.body);this.callApi("/api/v1/elevation/point/multi","POST",void 0,i,o,void 0,["application/json-patch+json","application/json","text/json","application/_*+json"],"json",t)}getElevationOfLine(e,t){let r=e||{},i={wkt:r.wkt,Srid:r.srid,Proj4String:r.proj4String,NumberOfSegments:r.numberOfSegments,ElevationUnit:r.elevationUnit,IntervalDistance:r.intervalDistance,IntervalDistanceUnit:r.intervalDistanceUnit};this.callApi("/api/v1/elevation/line","GET",{},i,void 0,void 0,[],"json",t)}getGradeOfLine(e,t){let r=e||{},i={wkt:r.wkt,Srid:r.srid,Proj4String:r.proj4String,NumberOfSegments:r.numberOfSegments,ElevationUnit:r.elevationUnit,IntervalDistance:r.intervalDistance,IntervalDistanceUnit:r.intervalDistanceUnit};this.callApi("/api/v1/elevation/grade/line","GET",void 0,i,void 0,void 0,[],"json",t)}getElevationOfArea(e,t){let r=e||{},i={wkt:r.wkt,Srid:r.srid,Proj4String:r.proj4String,IntervalDistance:r.intervalDistance,IntervalDistanceUnit:r.intervalDistanceUnit,ElevationUnit:r.elevationUnit};this.callApi("/api/v1/elevation/area","GET",{},i,void 0,void 0,[],"json",t)}};var m=class extends h{constructor(e){super(e)}project(e,t){let r=e||{},i=r.pointX,o=r.pointY,n=r.wkt,a=(r.body,r.fromProj),s=r.toProj;null!=i&&null!=o?this.projectForPoint(o,i,a,s,t):null!=n?this.projectForGeometry(n,a,s,t):this.projecForGeometries(r,t)}projectForPoint(e,t,r,i,o){if(null==e||""===e)throw new Error("Missing the required parameter 'pointY' when calling projectionForPoint");if(null==t||""===t)throw new Error("Missing the required parameter 'pointX' when calling projectionForPoint");if(null==r||""===r)throw new Error("Missing the required parameter 'fromProj' when calling projectionForPoint");if(null==i||""===i)throw new Error("Missing the required parameter 'toProj' when calling projectionForPoint");let n={pointY:e,pointX:t},a={fromProj:r,toProj:i};this.callApi("/api/v1/projection/{pointY},{pointX}","GET",n,a,{},void 0,[],"json",o)}projectForGeometry(e,t,r,i){if(null==e||""===e)throw new Error("Missing the required parameter 'wkt' when calling projectionForGeometry");if(null==t||""===t)throw new Error("Missing the required parameter 'fromProj' when calling projectionForGeometry");if(null==r||""===r)throw new Error("Missing the required parameter 'toProj' when calling projectionForGeometry");let o={wkt:e,fromProj:t,toProj:r};this.callApi("/api/v1/projection","GET",{},o,{},void 0,[],"json",i)}projectForGeometries(e,t){let r=e||{},i=JSON.stringify(r.body);this.callApi("/api/v1/projection/multi","POST",{},{},i,void 0,["application/json-patch+json","application/json","text/json","application/_*+json"],"json",t)}};var y=class extends h{constructor(e){super(e)}search(e,t){let r=e||{},i=r.location,o=r.body;null!=i?this.searchByPoint(i,t,r):null!=o&&this.searchBatch(r,t)}searchByPoint(e,t,r){if(null==e||""===e)throw new Error("Missing the required parameter 'searchText' when calling searchByPoint");let i={searchText:e},o=r||{};delete o.location;this.callApi("/api/v2/location/geocode/{searchText}","GET",i,o,{},void 0,[],"json",t)}searchBatch(e,t){let r=e||{},i=e||{};delete i.body;let o=r.body;this.callApi("/api/v2/location/geocode/multi","POST",{},i,o,void 0,["application/json-patch+json","application/json","text/json","application/_*+json"],"json",t)}};var v=class extends h{constructor(e){super(e),this._MAX_WKT_LENGTH_IN_GET_REQUEST=2e3}search(e,t){let r=e||{},i=r.pointX,o=r.pointY,n=r.body,a=r.placeId;null!=i&&null!=o?this.searchPlaceByPoint(o,i,t,r):null!=r.wkt?r.wkt.indexOf("LINESTRING")>=0||r.wkt.indexOf("linestring")>=0?this.searchPlaceByLine(r.wkt,t,r):this.searchPlaceByArea(r.wkt,t,r):null!=n?this.searchPlaceByPoints(r,t):null!=a&&this.searchPlaceById(a,t,r)}searchPlaceByPoint(e,t,r,i){let o=i||{};if(null==e||""===e)throw new Error("Missing the required parameter 'pointY' when calling searchPlaceByPoint");if(null==t||""===t)throw new Error("Missing the required parameter 'pointX' when calling searchPlaceByPoint");let n={pointY:e,pointX:t},a={Srid:o.srid,Proj4String:o.proj4String,Lang:o.lang,SearchRadius:o.searchRadius,SearchRadiusUnit:o.searchRadiusUnit,MaxResults:o.maxResults,LocationCategories:o.locationCategories,LocationTypes:o.locationTypes,VerboseResults:o.verboseResults,DistanceFromQueryFeatureUnit:o.distanceFromQueryFeatureUnit,IncludeOverturePlaces:o.includeOverturePlaces};this.callApi("/api/v1/location/reverse-geocode/{pointY},{pointX}","GET",n,a,null,void 0,[],"json",r)}searchPlaceByLine(e,t,r){let i=r||{};if(null==e||""===e)throw new Error("Missing the required parameter 'wkt' when calling searchPlaceByLine");if(e.length>this._MAX_WKT_LENGTH_IN_GET_REQUEST){let r="/api/v1/location/reverse-geocode/line",o="GET",n={},a={wkt:e,Srid:i.srid,Proj4String:i.proj4String,Lang:i.lang,SearchRadius:i.searchRadius,SearchRadiusUnit:i.searchRadiusUnit,MaxResults:i.maxResults,LocationCategories:i.locationCategories,LocationTypes:i.locationTypes,VerboseResults:i.verboseResults,DistanceFromQueryFeatureUnit:i.distanceFromQueryFeatureUnit,IncludeOverturePlaces:i.includeOverturePlaces},s=null,l=[],u="json";this.callApi(r,o,n,a,s,void 0,l,u,t)}else this.searchPlaceAdvanced({wkt:e,srid:i.srid,proj4String:i.proj4String,lang:i.lang,searchRadius:i.searchRadius,searchRadiusUnit:i.searchRadiusUnit,maxResults:i.maxResults,locationCategories:i.locationCategories,locationTypes:i.locationTypes,verboseResults:i.verboseResults,distanceFromQueryFeatureUnit:i.distanceFromQueryFeatureUnit},t)}searchPlaceByArea(e,t,r){let i=r||{};if(null==e||""===e)throw new Error("Missing the required parameter 'wkt' when calling searchPlaceByArea");if(e.length<this._MAX_WKT_LENGTH_IN_GET_REQUEST){let r="/api/v1/location/reverse-geocode/area",o="GET",n={},a={wkt:e,Srid:i.srid,Proj4String:i.proj4String,Lang:i.lang,SearchRadius:i.searchRadius,SearchRadiusUnit:i.searchRadiusUnit,MaxResults:i.maxResults,LocationCategories:i.locationCategories,LocationTypes:i.locationTypes,VerboseResults:i.verboseResults,DistanceFromQueryFeatureUnit:i.distanceFromQueryFeatureUnit,IncludeOverturePlaces:i.includeOverturePlaces},s=null,l=[],u="json";this.callApi(r,o,n,a,s,void 0,l,u,t)}else this.searchPlaceAdvanced({wkt:e,srid:i.srid,proj4String:i.proj4String,lang:i.lang,searchRadius:i.searchRadius,searchRadiusUnit:i.searchRadiusUnit,maxResults:i.maxResults,locationCategories:i.locationCategories,locationTypes:i.locationTypes,verboseResults:i.verboseResults,distanceFromQueryFeatureUnit:i.distanceFromQueryFeatureUnit,IncludeOverturePlaces:i.includeOverturePlaces},t)}searchPlaceByPoints(e,t){let r=e||{},i={Srid:r.srid,Proj4String:r.proj4String,Lang:r.lang,SearchRadius:r.searchRadius,SearchRadiusUnit:r.searchRadiusUnit,MaxResults:r.maxResults,LocationCategories:r.locationCategories,LocationTypes:r.locationTypes,VerboseResults:r.verboseResults,DistanceFromQueryFeatureUnit:r.distanceFromQueryFeatureUnit,IncludeOverturePlaces:r.includeOverturePlaces},o=JSON.stringify(r.body);this.callApi("/api/v1/location/reverse-geocode/multi","POST",{},i,o,void 0,["application/json-patch+json","application/json","text/json","application/_*+json"],"json",t)}searchPlaceById(e,t,r){let i=r||{};if(null==e||""===e)throw new Error("Missing the required parameter 'placeId' when calling searchPlaceById");let o={placeId:e},n={Srid:i.srid,Proj4String:i.proj4String,Lang:i.lang,SearchRadius:i.searchRadius,SearchRadiusUnit:i.searchRadiusUnit,MaxResults:i.maxResults,LocationCategories:i.locationCategories,LocationTypes:i.locationTypes,VerboseResults:i.verboseResults,DistanceFromQueryFeatureUnit:i.distanceFromQueryFeatureUnit,IncludeOverturePlaces:i.includeOverturePlaces};this.callApi("/api/v1/location/place/{placeId}","GET",o,n,null,void 0,[],"json",t)}getPlaceCatergories(e){this.callApi("/api/v1/location/reverse-geocode/location-categories","GET",{},{},null,void 0,[],"json",e)}getCommonCatergories(e){this.callApi("/api/v1/location/reverse-geocode/location-categories/common","GET",{},{},null,void 0,[],"json",e)}searchPlaceAdvanced(e,t){let r=e||{},i=JSON.stringify({Wkt:r.wkt,Srid:r.srid,Proj4String:r.proj4String,Lang:r.lang,SearchRadius:r.searchRadius,SearchRadiusUnit:r.searchRadiusUnit,MaxResults:r.maxResults,LocationCategories:r.locationCategories,LocationTypes:r.locationTypes,VerboseResults:r.verboseResults,DistanceFromQueryFeatureUnit:r.distanceFromQueryFeatureUnit,IncludeOverturePlaces:r.includeOverturePlaces});this.callApi("/api/v1/location/reverse-geocode/advanced","POST",{},{},i,void 0,["application/json-patch+json","application/json","text/json","application/_*+json"],"json",t)}};const f={None:"None",Common:"Common",All:"All",Aeroway:"Aeroway",Amenity:"Amenity",Barrier:"Barrier",Boundary:"Boundary",Building:"Building",Education:"Education",Entertainment:"Entertainment",Financial:"Financial",Healthcare:"Healthcare",Historic:"Historic",Leisure:"Leisure",Manmade:"Manmade",Natural:"Natural",Rail:"Rail",Power:"Power",Road:"Road",Shop:"Shop",Sport:"Sport",Sustenance:"Sustenance",Tourism:"Tourism",Transportation:"Transportation",Waterway:"Waterway",Intersection:"Intersection",AddressPoint:"AddressPoint",Others:"Others"};Object.freeze(f);var w=f;Error;var j=class extends h{constructor(e){super(e)}getColorsInAnalogousFamily(e,t){let r=e||{},i=r.color,o=r.numberOfColors;if(null==o||""===o)throw new Error("Missing the required parameter 'numberOfColors' when calling getColorsInAnalogousFamily");let n="/api/v1/color/scheme/analogous/random/{numberOfColors}",a={numberOfColors:o},s={outFormat:r.outFormat};i&&(n="/api/v1/color/scheme/analogous/{inputColor}/{numberOfColors}",a.inputColor=i,s.inFormat=r.inFormat);this.callApi(n,"GET",a,s,{},void 0,[],"json",t)}getColorsInComplementaryFamily(e,t){let r=e||{},i=r.color,o=r.numberOfColors;if(null==o||""===o)throw new Error("Missing the required parameter 'numberOfColors' when calling getColorSchemeComplementaryRandomByNumberOfColorV1");let n="/api/v1/color/scheme/complementary/random/{numberOfColors}",a={numberOfColors:o},s={outFormat:r.outFormat};i&&(n="/api/v1/color/scheme/complementary/{inputColor}/{numberOfColors}",a.inputColor=i,s.inFormat=r.inFormat);this.callApi(n,"GET",a,s,{},void 0,[],"json",t)}getColorsInContrastingFamily(e,t){let r=e||{},i=r.color,o=r.numberOfColors;if(null==o||""===o)throw new Error("Missing the required parameter 'numberOfColors' when calling getColorsInContrastingFamily");let n="/api/v1/color/scheme/contrasting/random/{numberOfColors}",a={numberOfColors:o},s={outFormat:r.outFormat};i&&(n="/api/v1/color/scheme/contrasting/{inputColor}/{numberOfColors}",a.inputColor=i,s.inFormat=r.inFormat);this.callApi(n,"GET",a,s,{},void 0,[],"json",t)}getColorsInHueFamily(e,t){let r=e||{},i=r.color,o=r.numberOfColors;if(null==o||""===o)throw new Error("Missing the required parameter 'numberOfColors' when calling getColorsInHueFamily");let n="/api/v1/color/scheme/sequential/random/{numberOfColors}",a={numberOfColors:o},s={outFormat:r.outFormat};i&&(n="/api/v1/color/scheme/sequential/{inputColor}/{numberOfColors}",a.inputColor=i,s.inFormat=r.inFormat);this.callApi(n,"GET",a,s,{},void 0,[],"json",t)}getColorsInQualityFamily(e,t){let r=e||{},i=r.color,o=r.numberOfColors;if(null==o||""===o)throw new Error("Missing the required parameter 'numberOfColors' when calling getColorsInQualityFamily");let n="/api/v1/color/scheme/qualitative/random/{numberOfColors}",a={numberOfColors:o},s={outFormat:r.outFormat};i&&(n="/api/v1/color/scheme/qualitative/{inputColor}/{numberOfColors}",a.inputColor=i,s.inFormat=r.inFormat);this.callApi(n,"GET",a,s,{},void 0,[],"json",t)}getColorsInTetradFamily(e,t){let r=e||{},i=r.color,o=r.numberOfColors;if(null==o||""===o)throw new Error("Missing the required parameter 'numberOfColors' when calling getColorSchemeTetradRandomByNumberOfColor");let n="/api/v1/color/scheme/tetrad/random/{numberOfColors}",a={numberOfColors:o},s={outFormat:r.outFormat};i&&(n="/api/v1/color/scheme/tetrad/{inputColor}/{numberOfColors}",a.inputColor=i,s.inFormat=r.inFormat);this.callApi(n,"GET",a,s,{},void 0,[],"json",t)}getColorsInTriadFamily(e,t){let r=e||{},i=r.color,o=r.numberOfColors;if(null==o||""===o)throw new Error("Missing the required parameter 'numberOfColors' when calling getColorsInTriadFamily");let n="/api/v1/color/scheme/triad/random/{numberOfColors}",a={numberOfColors:o},s={outFormat:r.outFormat};i&&(n="/api/v1/color/scheme/triad/{inputColor}/{numberOfColors}",a.inputColor=i,s.inFormat=r.inFormat);this.callApi(n,"GET",a,s,{},void 0,[],"json",t)}};const S={Default:"default",Light:"light",Dark:"dark",Hybrid:"hybrid",Aerial:"aerial",TransparentBackground:"transparentBackground"};Object.freeze(S);var T=S;var b=class extends h{constructor(e){super(e)}getRasterTile(e,t){let r=e||{},i=r.z,o=r.x,n=r.y,a=r.projection,s=r.mapType,l=r.tileSize,u=r.tileResolution;if(null==s||""===s)throw new Error("Missing the required parameter 'mapType' when calling getRasterTile");switch(s){case T.Default:s="light";break;case T.Light:case T.Dark:case T.Hybrid:case T.Aerial:break;case T.TransparentBackground:s="transparent-background";break;default:throw new Error("The 'style' didn't match any RasterMapType")}if(null==u||""===u)throw new Error("Missing the required parameter 'tileResolution' when calling getRasterTile");if(null==a||""===a)throw new Error("Missing the required parameter 'projection' when calling getRasterTile");if(null==l||""===l)throw new Error("Missing the required parameter 'tileSize' when calling getRasterTile");if(null==i||""===i)throw new Error("Missing the required parameter 'z' when calling getRasterTile");if(null==o||""===o)throw new Error("Missing the required parameter 'x' when calling getRasterTile");if(null==n||""===n)throw new Error("Missing the required parameter 'y' when calling getRasterTile");var c="jpeg";switch(style){case T.Aerial:case T.Hybrid:c="jpeg";break;case T.Light:case T.Dark:case T.TransparentBackground:default:c="png"}let p={style:s,resolution:u,srid:a,tileSize:l,tileZ:i,tileX:o,tileY:n,fileExtension:c};this.callApi("/api/v1/maps/raster/{style}/x{resolution}/{srid}/{tileSize}/{tileZ}/{tileX}/{tileY}.{fileExtension}","GET",p,{},{},void 0,[],"Blob",t)}getVectorTile(e,t){let r=e||{},i=r.z,o=r.x,n=r.y,a=r.projection;if(null==a||""===a)throw new Error("Missing the required parameter 'projection' when calling getVectorTile");if(null==i||""===i)throw new Error("Missing the required parameter 'z' when calling getVectorTile");if(null==o||""===o)throw new Error("Missing the required parameter 'x' when calling getVectorTile");if(null==n||""===n)throw new Error("Missing the required parameter 'y' when calling getVectorTile");let s={srid:a,tileZ:i,tileX:o,tileY:n};this.callApi("/api/v1/maps/vector/streets/{srid}/{tileZ}/{tileX}/{tileY}.pbf","GET",s,{},{},void 0,[],"arrayBuffer",t)}};const R={SphericalMercator:3857};Object.freeze(R);var C=R;const F={Default:1,Standard:1,High:2};Object.freeze(F);var E=F;const O={Default:512,Small:256,Medium:512};Object.freeze(O);var A=O;var P=class extends h{constructor(e){super(e)}getRoute(e,t,r){let i=r||{},o={coordinates:e.map(e=>e.y+","+e.x).join(";")},n={Srid:i.srid,Proj4String:i.proj4String,TurnByTurn:i.turnByTurn,CoordinateSnapRadius:i.coordinateSnapRadius,CoordinateSnapRadiusUnit:i.coordinateSnapRadiusUnit,DistanceUnit:i.distanceUnit,DurationUnit:i.durationUnit};this.callApi("/api/v1/route/{coordinates}","GET",o,n,null,void 0,[],"json",t)}getServiceArea(e,t,r,i,o){let n=o||{},a={pointX:t,pointY:e},s={ServiceLimits:r,Srid:n.srid,Proj4String:n.proj4String,ContourGranularity:n.contourGranularity,CoordinateSnapRadius:n.coordinateSnapRadius,CoordinateSnapRadiusUnit:n.coordinateSnapRadiusUnit,DistanceUnit:n.distanceUnit,DurationUnit:n.durationUnit,GridSizeInMeters:n.gridSizeInMeters,ServiceAreaSeparationType:n.serviceAreaSeparationType,ServiceAreaType:n.serviceAreaType,ServiceLimitsType:n.serviceLimitsType,TravelDirection:n.travelDirection};this.callApi("/api/v1/service-area/{pointY},{pointX}","GET",a,s,null,void 0,[],"json",i)}getCostMatrix(e,t,r,i){const o=i||{};const n={origins:e.map(e=>e.y+","+e.x).join(";"),destinations:t.map(e=>e.y+","+e.x).join(";"),costMatrixType:o.costMatrixType,srid:o.srid,proj4String:o.proj4String,coordinateSnapRadius:o.coordinateSnapRadius,coordinateSnapRadiusUnit:o.coordinateSnapRadiusUnit,durationUnit:o.durationUnit,distanceUnit:o.distanceUnit};this.callApi("/api/v1/route/matrix","GET",{},n,null,void 0,[],"json",r)}optimization(e,t,r){let i=r||{},o={coordinates:e.map(e=>e.y+","+e.x).join(";")},n={CoordinateSnapRadius:i.coordinateSnapRadius,CoordinateSnapRadiusUnit:i.coordinateSnapRadiusUnit,Destination:i.destination,DistanceUnit:i.distanceUnit,DurationUnit:i.durationUnit,Proj4String:i.proj4String,Roundtrip:i.roundtrip,Source:i.source,Srid:i.srid,TurnByTurn:i.turnByTurn};this.callApi("/api/v1/route/optimization/{coordinates}","GET",o,n,null,void 0,[],"json",t)}};var U=class extends h{constructor(e){super(e)}getTimeZoneByCoordinate(e,t,r,i){let o=i||{};if(null==e||""===e)throw new Error("Missing the required parameter 'pointY' when calling getTimeZoneByCoordinate");if(null==t||""===t)throw new Error("Missing the required parameter 'pointX' when calling getTimeZoneByCoordinate");let n={pointY:e,pointX:t},a={Srid:o.srid,Proj4String:o.proj4String};this.callApi("/api/v1/timezones/{pointY},{pointX}","GET",n,a,null,void 0,[],"json",r)}getAllTimeZoneNames(e){this.callApi("/api/v1/timezones","GET",void 0,{},null,void 0,[],"json",e)}getAllTimeZones(e){this.callApi("/api/v1/timezones/geometry","GET",void 0,{},null,void 0,[],"json",e)}};var x=class extends h{constructor(e){super(e)}getFeaturesWithin(e,t,r,i){this._spatialQuery(e,t,"within",r,i)}getFeaturesContaining(e,t,r,i){this._spatialQuery(e,t,"containing",r,i)}getFeaturesIntersecting(e,t,r,i){this._spatialQuery(e,t,"intersecting",r,i)}getFeaturesOverlapping(e,t,r,i){this._spatialQuery(e,t,"overlapping",r,i)}getFeaturesTouching(e,t,r,i){this._spatialQuery(e,t,"touching",r,i)}getFeaturesNearest(e,t,r,i){if(null==e||""===e)throw new Error("Missing the required parameter 'layerName' when calling getFeaturesNearest");if(null==t||""===t)throw new Error("Missing the required parameter 'wkt' when calling getFeaturesNearest");let o=i||{},n={queryLayer:e},a={Wkt:t,Srid:o.srid,Proj4String:o.proj4String,SearchRadius:o.searchRadius,SearchRadiusUnit:o.searchRadiusUnit,MaxResults:o.maxResults,ReturnFeatureAttributes:o.returnFeatureAttributes,FeatureAttributesToReturn:o.featureAttributesToReturn};this.callApi("/api/v1/maps/query/{queryLayer}/nearest","GET",n,a,null,void 0,[],"json",r)}getFeaturesWithinDistance(e,t,r,i){if(null==e||""===e)throw new Error("Missing the required parameter 'layerName' when calling getFeaturesWithinDistance");if(null==t||""===t)throw new Error("Missing the required parameter 'wkt' when calling getFeaturesWithinDistance");let o=i||{},n={queryLayer:e},a={Wkt:t,Srid:o.srid,Proj4String:o.proj4String,Distance:o.distance,DistanceUnit:o.distanceUnit,MaxResults:o.maxResults,ReturnFeatureAttributes:o.returnFeatureAttributes,FeatureAttributesToReturn:o.featureAttributesToReturn};this.callApi("/api/v1/maps/query/{queryLayer}/within-distance","GET",n,a,null,void 0,[],"json",r)}getFeaturesCustom(e,t,r,i,o){if(null==e||""===e)throw new Error("Missing the required parameter 'layerName' when calling getFeaturesCustom");if(null==t||""===t)throw new Error("Missing the required parameter 'wkt' when calling getFeaturesCustom");if(null==r||""===r)throw new Error("Missing the required parameter 'queryType' when calling getFeaturesCustom");let n=o||{},a=JSON.stringify({QueryLayer:e,QueryType:r,Wkt:t,Srid:n.srid,Proj4String:n.proj4String,Distance:n.distance,DistanceUnit:n.distanceUnit,SearchRadius:n.searchRadius,SearchRadiusUnit:n.searchRadiusUnit,MaxResults:n.maxResults,ReturnFeatureAttributes:n.returnFeatureAttributes,FeatureAttributesToReturn:n.featureAttributesToReturn});this.callApi("/api/v1/maps/query/custom","POST",{},{},a,void 0,["application/json-patch+json","application/json","text/json","application/_*+json"],"json",i)}getLayers(e){this.callApi("/api/v1/maps/query/layers","GET",void 0,{},null,void 0,"","json",e)}getAttributesOfLayer(e,t){if(null==e||""===e)throw new Error("Missing the required parameter 'layerName' when calling getAttributesOfLayer");let r={queryLayer:e};this.callApi("/api/v1/maps/query/{queryLayer}/attributes","GET",r,void 0,null,void 0,[],"json",t)}_spatialQuery(e,t,r,i,o){if(null==e||""===e)throw new Error("Missing the required parameter 'layerName' when calling _spatialQuery");if(null==t||""===t)throw new Error("Missing the required parameter 'wkt' when calling _spatialQuery");let n=o||{},a={queryLayer:e,queryType:r},s={Wkt:t,Srid:n.srid,Proj4String:n.proj4String,MaxResults:n.maxResults,ReturnFeatureAttributes:n.returnFeatureAttributes,FeatureAttributesToReturn:n.featureAttributesToReturn};this.callApi("/api/v1/maps/query/{queryLayer}/{queryType}","GET",a,s,null,void 0,[],"json",i)}};let M={};M.DistanceUnit=o,M.BaseClient=h,M.ElevationClient=g,M.ProjectionClient=m,M.GeocodingClient=y,M.ReverseGeocodingClient=v,M.LocationCategories=w,M.ColorClient=j,M.MapsClient=b,M.RasterMapType=T,M.MapProjection=C,M.TileResolution=E,M.TileSize=A,M.RoutingClient=P,M.TimeZoneClient=U,M.MapsQueryClient=x;t.default=M}]).default})); //# sourceMappingURL=thinkgeocloudclient.js.map