Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@maptiler/geocoder
Advanced tools
JavaScript component for geographical search provided as part of MapTiler Cloud.
<html>
<head>
<script src="https://cdn.maptiler.com/maptiler-geocoder/v1.1.0/maptiler-geocoder.js"></script>
<link href="https://cdn.maptiler.com/maptiler-geocoder/v1.1.0/maptiler-geocoder.css" rel="stylesheet" />
</head>
<body>
<input id="search" type="text" />
<script>
var geocoder = new maptiler.Geocoder({
input: 'search', // id of input element
key: 'get_your_own_key'
});
geocoder.on('select', function(item) {
console.log('Selected', item);
});
</script>
</body>
</html>
var geocoder = new maptiler.Geocoder({
key: 'get_your_own_key'
});
geocoder.geocode('Zurich')
.then(function(results) {
console.log(results.features[0]);
});
Note: You can get your own keys for free at https://cloud.maptiler.com.
string
Promise.<GeocodingResult>
Param | Type | Default | Description |
---|---|---|---|
options | Object | ||
options.key | string | Access key from https://cloud.maptiler.com/ | |
[options.input] | string | HTMLInputElement | null | null | If no input is provided, the autocomplete will not be initiated, but the rest of the methods can still be used. Most notably .geocode(query). |
[options.autocompleteWaitMs] | number | 500 | Number of milliseconds to wait before autocompleting. At most one request will be sent within this timeframe. Useful if you want to wait for the user to finish typing. Does not have any effect if input is not specified. |
[options.language] | string | Array.<string> | null | Specifies language preference e.g. en,de , null to disable. |
[options.bounds] | Array.<number> | null | Search only within the specified bounds [minx, miny, maxx, maxy] , null to disable. |
[options.proximity] | Array.<number> | null | Prefer results closer to the specified point [lon, lat] , null to disable. |
Param | Type |
---|---|
language | string | Array.<string> | null |
Param | Type |
---|---|
bbox | Array.<number> | null |
Param | Type |
---|---|
point | Array.<number> | null |
string
Param | Type |
---|---|
query | string |
Promise.<GeocodingResult>
Performs the search with the given query
and currently set geocoder options.
Param | Type |
---|---|
query | string |
The Geocoder inherits from EventEmitter, so you can use the related methods. Most notably geocoder.on
(see EventEmitter#on) to listen for events:
geocoder.on('select', function(item) {
console.log('Selected', item);
});
Possible event types:
select
Emitted when user selects an item.
hover
Emitted when user hovers over and item in the autocomplete list.
GeoJSONFeatureCollection
The result of the geocoding is always a GeoJSON
with individual items in a FeatureCollection
at the root (features
property).
Properties
Name | Type |
---|---|
features | Array.<GeocodingResultItem> |
GeoJSONFeature
FAQs
Geographical search via MapTiler Cloud
The npm package @maptiler/geocoder receives a total of 245 weekly downloads. As such, @maptiler/geocoder popularity was classified as not popular.
We found that @maptiler/geocoder demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.