Leaflet Map Control

Determine Asset Locations using Address Geocoding

Technologies > User Interface Add-Ins> Geographic Information System (GIS) Views > Map with Address Geocoder (Leaflet)

This example uses geocoding to determine building location based on its address information.

Geographic coordinates, or latitude and longitude, are needed to display asset locations on a map. If geographic coordinates are known, they may be entered directly into Web Central. If geographic coordinates are not known, they can be determined through geocoding using the asset’s street address.

Include the geocoder JavaScript class in the AXVW:

<!-- esri leaflet geocoder -->  <js url="http://cdn-geoweb.s3.amazonaws.com/e...et-geocoder.js" /> <css url="http://cdn-geoweb.s3.amazonaws.com/e...t-geocoder.css" /> <> <!-- archibus leaflet esri geocode control --> <js file="ab-leaflet-esrigeocoder.js"/>

Create an instance of the Geocode Control, passing a reference to the map control:

this.geocodeControl = new Ab.leaflet.EsriGeocoder(this.mapControl);

Call geocode(), passing a restriction for the selected rows (see table of parameters below):

var restriction = this.getRestriction(rows);
this.geocodeControl.geocode(
'bl_ds',
restriction,
'bl',
'bl.bl_id',
['bl.lat', 'bl.lon'],
['bl.address1', 'bl.city_id', 'bl.state_id', 'bl.zip', ‘bl.ctry_id’],
true
);

Geocode Parameters

Parameter

Description

DataSource Name

The records data source

Restriction

Records restriction

Table Name

Table to which the record's geometry information will be added

Primary Key Field

The primary key field for the table

Geometry Fields

The geometry fields for the table

Address Fields

The address fields for the table.

Replace

Boolean. Whether to replace the existing geometry information.

View: http://localhost:8080/archibus/ab-leaflet-esri-geocode.axvw