Methods
geocode(obj, cb) → {Promise.<module:index~GeocodeResponse>}
It geocodes an address. The found position is transmitted to the callback function as parameter.
Parameters:
Name | Type | Description |
---|---|---|
obj |
module:index~GeocodeOptions |
The hash object representing the address to geocode. |
cb |
function |
The callback to call. Called with the position in EPSG:2169 (LUREF) of the geocoded address. |
Returns:
Promise that returns the geocoding response.
- Type
- Promise.<module:index~GeocodeResponse>
Examples
lux.geocode({
queryString: ' 1 Rue Charles Darwin 1433 Luxembourg'
}, function(position) {
console.log (position);
});
lux.geocode({
num: 1,
street: 'Rue Charles Darwin',
zip: 1433,
locality: 'luxembourg'
}, function(position) {
console.log (position);
});
reverseGeocode(coordinate, cb) → {Promise.<module:index~ReverseGeocodeResponse>}
It returns the most closest address of a given point.
Parameters:
Name | Type | Description |
---|---|---|
coordinate |
ol.Coordinate |
The coordinates to look for an address. Coordinates must be given in EPSG:2169. |
cb |
function |
The callback function to call. Called with the address represented by ReverseGeocodeResult. |
Returns:
Promise that returns the reverse geocoding response.
- Type
- Promise.<module:index~ReverseGeocodeResponse>
Example
lux.reverseGeocode([75979,75067], function(address) {
var html = [address.number, address.street, address.postal_code + ' ' + address.locality] .join(', ');
console.log(html);console.log(address);
});