Lands Address Geocode

by LandsD Map API

HTML

<link rel="stylesheet" href="https://win2016.eastasia.cloudapp.azure.com/landsd_js_api/3.17/dijit/themes/nihilo/nihilo.css">
<link rel="stylesheet" href="https://landsapp.azurewebsites.net/landsd_js_api/3.17/esri/css/esri.css">
<script src="https://landsapp.azurewebsites.net/landsd_js_api/3.17/dojo/dojo.js"></script>
<link rel="stylesheet" href="https://landsapp.azurewebsites.net/landsd_js_api/3.17/dijit/themes/nihilo/nihilo.css">
<script src="https://landsapp.azurewebsites.net/landsd_js_api/3.17/dojo/dojo.js"></script>

<body class="nihilo">
  <div id="search"></div>
  <div id="map-area" style="height:320px"></div>
</body>

CSS

#search {
   display: block;
   position: absolute;
   z-index: 2;
   top: 30px;
   left: 75px;
 }

JavaScript

require([
	  "dojo/_base/array",
	  "dojo/dom",
	  "esri/tasks/locator",
	  "esri/dijit/Search",
	  "esri/symbols/PictureMarkerSymbol",
	  "esri/InfoTemplate",
	  "landsd/layers/TileCacheBaseMapLayer",
	  "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(
	  arrayUtils, dom, Locator, Search, PictureMarkerSymbol, InfoTemplate,
	  TileCacheBaseMapLayer,
	  Popup,
	  PopupTemplate,
	  FeatureLayer, Map, Scalebar
	) {
	  var locatorAddressUrl = "https://landsapi.azure-api.net/arcgis/rest/services/MapAPI/LandsGeocode/GeocodeServer?key=e68810d810e144358961d2295b515f60";
//	  var locatorGeoCommUrl = "https://landsapi.azure-api.net/arcgis/rest/services/MapAPI/GEOCOMMGEOCODE/GeocodeServer?key=e68810d810e144358961d2295b515f60";

	  var bLayer = new TileCacheBaseMapLayer();
    bLayer.tileUrl='https://landsapi.azure-api.net/HKMapServiceBase';
	  bLayer.api_key = 'e68810d810e144358961d2295b515f60';

	  //var popup = new Popup({}, document.createElement("div"));
	  var map = new Map("map-area", {
	    //center: [-82.44109, 35.6122],
	    zoom: 15,
	    minZoom: 10,
	    maxZoom: 20
	      //infoWindow: popup
	  });

	  map.addLayer(bLayer);

	  //Search Input Box
	  var search = new Search({
	    sources: [],
	    map: map,
	    enableSearchingAll: false,
	    autoComplete: true,
	    value: ""
	  }, "search");

    search.on('select-result',function(e){
     	   search.value = e.result.name;
    });
    search.on('suggest-results', function(e){
    	 for (var intI=0; intI< e.results[0].length; intI++)
       {
       	   e.results[0][intI].magicKey=' ';
       }
    });
	  search.on("load", function() {
	    var _sources = search.sources;
	    _sources.push({
	      //Pass in the custom locator to the sources
	      locator: new...