Lands ArcGIS Geocode-ALL
Lands ArcGIS Geocode-ALL
by LandsD Map API
HTML
<link rel="stylesheet" href="https://js.arcgis.com/3.20/esri/css/esri.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.20/dijit/themes/nihilo/nihilo.css">
<script src="https://js.arcgis.com/3.35/"></script>
<div id="search"></div>
<div id="map-area"></div>
<div id="landsdlogo" class="landsdlogo"></div>
CSS
html,
body,
#map-area {
//height: 100%;
//width: 100%;
margin: 2;
padding: 2;
}
#search {
display: block;
position: absolute;
z-index: 2;
top: 30px;
left: 75px;
}
.logo-med {
width: 46px !important;
height: 22px !important;
background-image: url(https://js.arcgis.com/3.20/esri/images/map/logo-sm.png) !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;
}
.esriAttribution a{
color: black;
}
.esriAttribution {
background: transparent;
font-size: 12px;
font-family: sans-serif;
color: black;
}
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';
/////
var map
var apikey = '584b2fa686f14ba283874318b3b8d6b0'
require([
"dojo/dom",
"esri/tasks/locator",
"esri/dijit/Search",
"esri/symbols/PictureMarkerSymbol",
"esri/InfoTemplate",
"esri/layers/ArcGISTiledMapServiceLayer",
"esri/SpatialReference",
"esri/geometry/Point",
"esri/dijit/Popup",
"esri/dijit/PopupTemplate",
"esri/layers/FeatureLayer",
"esri/map",
"esri/dijit/Scalebar",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/TitlePane",
"dijit/form/CheckBox",
'dojo/_base/json',
"dojo/domReady!"
], function(
dom, Locator, Search, PictureMarkerSymbol, InfoTemplate,
ArcGISTiledMapServiceLayer, SpatialReference, Point,
Popup,
PopupTemplate,
FeatureLayer, Map,
Scalebar
) {
var locatorUrls = [
{
name: 'AddressPoint',
placeholder: 'Composite Locator',
url: 'https://api.hkmapservice.gov.hk/ags/gc/composite'
}
];
var bLayer = new ArcGISTiledMapServiceLayer('https://api.hkmapservice.gov.hk/ags/map/basemap/HK80?key=' + apikey, {
showAttribution: true
});
var bLabelLayer = new ArcGISTiledMapServiceLayer('https://api.hkmapservice.gov.hk/ags/map/label-sc/HK80?key=' + apikey);
var _map = new Map("map-area", {
center: new Point(823100,831200, new SpatialReference({ wkid: 2326 })),
showAttribution: true,
zoom: 11,
minZoom: 10,
maxZoom: 19
});
/*
var attrib = new Attribution({map:_map},"attributionDiv");
attrib.itemDelimiter = ",";
attrib.itemNodes =...