Class: Address

cercaliagl.control/Address


Javascript ES5

const control = new cercaliagl.control.Address();
map.addControl(control);

Class cercaliagl.control.Address is used for internal purposes, but can be accessed throught methods. This methods apply actions to Adress UI component. By default it appears in bottom-left corner. It shows address summary address and detailed address with all geoentity components

Usage getting address control from map:

const map = new cercaliagl.Map({ target: 'map' });
const address = map.getControlByName(cercaliagl.control.MapControls.ADDRESS);
address.getDirection(new cercaliagl.LonLat(-3.682, 40.43059), (data) => console.log(data));

new Address()

Extends

Methods

Clear all painted overlays on the map related to this control

Closes address UI address element

directionTo()

Set current address to routing destination. If there is navbar enabled destination route is assigned with current opened address

Returns cercalia Map object

Returns:
Cercalia map.

getClass(){string} inherited

Get class name.

Returns:
Class name.

Return geoentity data module:cercaliagl/servers~GeEntity from current address. Returns null if this control isn't showing any

Returns:
ge GeEntity.

getDirection(lonLat, callbackFn, hideMarker, hidePopUp, preserveOriginalPosition)

Get direction giving position and shows response in UI address component. Optionally, you can provide addition callback function.

Name Type Description
lonLat module:cercaliagl/LonLat~LonLat

Position

callbackFn function

Callback function

hideMarker boolean

Disables the default option to create a marker on the position

hidePopUp boolean

Disables the default option to show a popup with the position information

preserveOriginalPosition boolean

If true, the original position is preserved, false by default

getElement(){Element} inherited

Get control HTML Element

Returns:
HTML Element

Get control id.

Returns:
Id.

getMap(){module:maplibre-gl~Map} inherited

Returns mapboxgl Map object

getName(){string|null} inherited

Get control name. Null if control has not defined name.

Returns:
Class name.

goToCoordinates(lonLat, panTo)

Center map to coordinates and draw a marker with a label with position coordinates. It doesn't obtain reverse geocoding data.

Name Type Description
lonLat module:cercaliagl/LonLat~LonLat

Position.

panTo boolean

Pan Zoom to position.

goToGeEntity(ge, panTo)

Open a direction using GeEntity from server response. Then it shows addres UI with filled data about address components

Name Type Description
ge module:cercaliagl/servers~GeEntity

GeEntity.

panTo boolean (defaults to true)

Pan Zoom to position.

ge.article string | null | undefined
ge.city module:cercaliagl/servers~ObjectJSON | null | undefined
ge.coord module:cercaliagl/servers~Coord | null | undefined
ge.country module:cercaliagl/servers~ObjectJSON | null | undefined
ge.dist string | null | undefined
ge.frc string | null | undefined
ge.housenumber module:cercaliagl/servers~ObjectJSON | null | undefined
ge.id string | null | undefined
ge.intersection module:cercaliagl/servers~ObjectJSON | null | undefined
ge.km module:cercaliagl/servers~ObjectJSON | null | undefined
ge.kmh string | null | undefined
ge.label string | null | undefined
ge.geometry module:cercaliagl/servers~GeEntityGeometry | null | undefined
ge.municipality module:cercaliagl/servers~ObjectJSON | null | undefined
ge.name module:cercaliagl/servers~ObjectJSON | string | undefined
ge.pos string | null | undefined
ge.postalcode module:cercaliagl/servers~ObjectJSON | module:cercaliagl/servers~PostalCode | null | undefined
ge.prefix string | null | undefined
ge.region module:cercaliagl/servers~ObjectJSON | null | undefined
ge.sname string | null | undefined
ge.subcategory_id module:cercaliagl/servers~ObjectJSON | string | null | undefined
ge.subregion module:cercaliagl/servers~ObjectJSON | null | undefined
ge.type string | null | undefined
ge.zonename string | null | undefined
ge.zonetype string | null | undefined
ge.zonetype string | null | undefined
ge.zonetype string | null | undefined
ge.zonetype string | null | undefined

goToPostalcode(countryId, pcode, panTo)

Make a geocoding request to obtain postal code by country. It shows a marker and draw a polygon with its extension. Once postal code data is returned this function pan to postal code centroid. Optionally is possible to disable this pan.

Name Type Description
countryId string

Country Id. For example: ESP or FRA.

pcode string

Postal code.

panTo boolean (defaults to true)

Optional pan to location.

Hide control.

setSearchAddressCallbackFunction(callbackFn)

Add a custom callback function called when a address is searched via context menu map. This function will receive LonLat and ProximityResult

Name Type Description
callbackFn function | null

Callback function

Show control.