-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
129 changed files
with
1,952 additions
and
598 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
define([ | ||
'../Core/freezeObject' | ||
], function( | ||
freezeObject) { | ||
'use strict'; | ||
|
||
/** | ||
* The type of geocoding to be performed by a {@link GeocoderService}. | ||
* @exports GeocodeType | ||
* @see Geocoder | ||
*/ | ||
var GeocodeType = { | ||
/** | ||
* Perform a search where the input is considered complete. | ||
* | ||
* @type {Number} | ||
* @constant | ||
*/ | ||
SEARCH: 0, | ||
|
||
/** | ||
* Perform an auto-complete using partial input, typically | ||
* reserved for providing possible results as a user is typing. | ||
* | ||
* @type {Number} | ||
* @constant | ||
*/ | ||
AUTOCOMPLETE: 1 | ||
}; | ||
|
||
return freezeObject(GeocodeType); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
define([ | ||
'./Check', | ||
'./defaultValue', | ||
'./defined', | ||
'./defineProperties', | ||
'./Ion', | ||
'./PeliasGeocoderService', | ||
'./Rectangle', | ||
'./Resource' | ||
], function ( | ||
Check, | ||
defaultValue, | ||
defined, | ||
defineProperties, | ||
Ion, | ||
PeliasGeocoderService, | ||
Rectangle, | ||
Resource) { | ||
'use strict'; | ||
|
||
/** | ||
* Provides geocoding through Cesium ion. | ||
* @alias IonGeocoderService | ||
* @constructor | ||
* | ||
* @param {Object} [options] Object with the following properties: | ||
* @param {String} [options.accessToken=Ion.defaultAccessToken] The access token to use. | ||
* @param {String|Resource} [options.server=Ion.defaultServer] The resource to the Cesium ion API server. | ||
* | ||
* @see Ion | ||
*/ | ||
function IonGeocoderService(options) { | ||
options = defaultValue(options, defaultValue.EMPTY_OBJECT); | ||
|
||
var accessToken = defaultValue(options.accessToken, Ion.defaultAccessToken); | ||
var server = Resource.createIfNeeded(defaultValue(options.server, Ion.defaultServer)); | ||
server.appendForwardSlash(); | ||
|
||
var searchEndpoint = server.getDerivedResource({ | ||
url: 'v1/geocode' | ||
}); | ||
|
||
if (defined(accessToken)) { | ||
searchEndpoint.appendQueryParameters({ access_token: accessToken }); | ||
} | ||
|
||
this._accessToken = accessToken; | ||
this._server = server; | ||
this._pelias = new PeliasGeocoderService(searchEndpoint); | ||
} | ||
|
||
/** | ||
* @function | ||
* | ||
* @param {String} query The query to be sent to the geocoder service | ||
* @param {GeocodeType} [type=GeocodeType.SEARCH] The type of geocode to perform. | ||
* @returns {Promise<GeocoderResult[]>} | ||
*/ | ||
IonGeocoderService.prototype.geocode = function (query, geocodeType) { | ||
return this._pelias.geocode(query, geocodeType); | ||
}; | ||
|
||
return IonGeocoderService; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.