Specify Asset Locations using the Asset Locator
Standard Esri Map Control
Specify Asset Locations using the Asset Locator
Technologies > User Interface Add-Ins> Geographic Information System (GIS) Views > Map with Asset Locator
In cases where assets have a street address, we can use address geocoding to return geographic coordinates for the asset. In cases where assets do not have a street address, or where address geocoding returns coordinates with insufficient accuracy, we can specify asset locations with the Asset Locator. This example uses the Asset Locator to specify asset locations by clicking on the map.
Include the asset locator JavaScript class in the AXVW:
<js file="ab-arcgis-assetlocator.js"/>
Create an instance of the Asset Locator Tool, passing the map control:
mapController.locateAssetTool = new Ab.arcgis.AssetLocator(mapController.mapControl);
Call
startLocate()
, passing a restriction for the desired row:
mapController.locateAssetTool.startLocate(
‘assetDS’
restriction
‘bl.bl_id’
[‘bl.lon’, ‘bl.lat’]
[‘bl.address1’, ‘bl.city_id’, ‘bl.state_id’, ‘bl.ctry_id’]
);
A marker will be placed at the center of the current map:
Click on the map to move the marker location:
Call
finishLocate()
to retrieve the coordinates from the current marker position:
var assetCoords = mapController.locateAssetTool.finishLocate();
Save the coordinates back to the asset record.
var lon = assetCoords[0];
var lat = assetCoords[1];
assetRecord.setValue(‘bl.lon’, lon);
assetRecord.setValue(‘bl.lat’, lat)
mapController.assetDS.saveRecord(assetRecord);
Sample view: http://localhost:8080/archibus/ab-arcgis-locate-asset.axvw