Lands ArcGIS Reverse Geocode
Lands ArcGIS Reverse Geocode
by LandsD Map API
HTML
<link rel="stylesheet" href="https://js.arcgis.com/3.33/esri/css/esri.css">
<script src="https://js.arcgis.com/3.35/"></script>
<body class="nihilo">
<div id="map-area" class="shadow"></div>
<div id="landsdlogo" class="landsdlogo"></div>
<div id="hint">Click to reverse geocode</div>
<div style="position:absolute;right:5px;top:5px;background:white;padding:2px 2px">
<span style="margin-right:5px;">Select a reverse locator</span><select id="select">
<option value=""></option>
</select>
</div>
</body>
CSS
html,
body,
#map-area {
//height: 100%;
//width: 100%;
margin: 2;
padding: 2;
font-family: sans-serif;
}
body {
background-color: #FFFFFF;
overflow: hidden;
font-family: "Trebuchet MS";
position: relative;
}
.esriAttribution a{
color: black;
}
.esriAttribution{
background: transparent;
font-family: sans-serif;
font-size: 12px;
color: black;
}
.logo-med,
.logo-sm {
width: 46px !important;
height: 22px !important;
background-image: url(https://js.arcgis.com/3.20/esri/images/map/logo-sm.png) !important;
display: none !important;
}
#landsdlogo {
display: inline-block;
vertical-align: bottom;
width: 25px;
height: 25px;
background: url(https://mapapis01.blob.core.windows.net/images/landsdlogo.jpg);
background-repeat: no-repeat;
background-size: 25px 25px;
}
#hint {
position: absolute;
bottom: 5px;
left: 5px;
background: white;
padding: 2px;
font-size: 13px;
}
JavaScript
// resize map
const mapdiv = window['map-area'];
var margin;
if (document.all) {
margin = parseInt(document.body.currentStyle.marginTop, 10) + parseInt(document.body.currentStyle.marginBottom, 10);
} else {
margin = parseInt(document.defaultView.getComputedStyle(document.body, '').getPropertyValue('margin-top')) + parseInt(document.defaultView.getComputedStyle(document.body, '').getPropertyValue('margin-bottom'));
}
mapdiv.style.height = (window.innerHeight - margin) + 'px';
/////
require([
"esri/basemaps", "esri/map", "esri/graphic", "esri/SpatialReference", "esri/tasks/locator", "esri/Color", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/InfoTemplate", "dojo/_base/array", "dojo/domReady!"
], function (esriBasemaps, Map, Graphic, SpatialReference, Locator, Color, SimpleMarkerSymbol, SimpleLineSymbol, InfoTemplate, Array){
esriBasemaps.landsd = {
baseMapLayers: [
{url: "https://api.hkmapservice.gov.hk/ags/map/basemap/WGS84?key="+apikey},
{url: "https://api.hkmapservice.gov.hk/ags/map/label-en/WGS84?key="+apikey}
],
};
var locatorUrls = [{
name: 'Building Name',
placeholder: 'Building Name',
url: 'https://api.hkmapservice.gov.hk/ags/gc/ib1000/buildings/building?key='+apikey
},{
name: 'Site Name',
placeholder: 'Site Name',
url: 'https://api.hkmapservice.gov.hk/ags/gc/ib1000/buildings/site?key='+apikey
},{
name: 'SubSite Name',
placeholder: 'SubSite Name',
url: 'https://api.hkmapservice.gov.hk/ags/gc/ib1000/buildings/subsite?key='+apikey
},{
name: 'Building CSUID',
placeholder: 'e.g. 1429629890T20050430',
url: 'https://api.hkmapservice.gov.hk/ags/gc/loc/buildingcsuid?key='+apikey
},{
name: 'Lot CSUID',
placeholder: 'e.g. 2570 158 B',
url:...