Methods
geocode(obj, cb) → {Promise.<luxx.GeocodeResponse>}
It geocodes an address. The found position is transmitted to the callback function as parameter.
Parameters:
Name | Type | Description | ||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
obj |
luxx.GeocodeOptions | The hash object representing the address to geocode. Properties
|
||||||||||||||||||
cb |
function | The callback to call. Called with the position in EPSG:2169 (LUREF) of the geocoded address. |
- Source:
Returns:
Promise that returns the geocoding response.
- Type
- Promise.<luxx.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.<luxx.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 luxx.ReverseGeocodeResult. |
- Source:
Returns:
Promise that returns the reverse geocoding response.
- Type
- Promise.<luxx.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);
});