Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require([
- "esri/WebMap",
- "esri/views/MapView",
- "esri/widgets/Expand",
- "esri/widgets/Legend",
- "esri/widgets/BasemapGallery",
- "esri/widgets/Home",
- "esri/widgets/Locate",
- "esri/widgets/Search",
- "esri/widgets/LayerList",
- "esri/widgets/Print",
- "esri/layers/FeatureLayer",
- "esri/tasks/Locator",
- "esri/widgets/ScaleBar",
- "dojo/domReady!"
- ], function(
- WebMap, MapView, Expand, Legend, BasemapGallery, Home, Locate, Search, LayerList, Print, FeatureLayer, Locator, ScaleBar
- ) {
- /************************************************************
- * Creates a new WebMap instance. A WebMap must reference
- * a PortalItem ID that represents a WebMap saved to
- * arcgis.com or an on-premise portal.
- *
- * To load a WebMap from an on-premise portal, set the portal
- * url in esriConfig.portalUrl.
- ************************************************************/
- var webmap = new WebMap({
- portalItem: { // autocasts as new PortalItem()
- id: "xxxxxxI'veEditedOutThePortalIDButTrustMeItIsCorrectxxxxxxx"
- }
- });
- /************************************************************
- * Set the WebMap instance to the map property in a MapView.
- ************************************************************/
- var view = new MapView({
- map: webmap,
- container: "viewDiv"
- });
- var legend = new Legend({
- view: view,
- container: document.createElement('div'),
- layerInfos: [{
- layer: webmap,
- title: "Legend"
- }]
- });
- var legendExpand = new Expand({
- view: view,
- content: legend.domNode,
- container: 'legendDiv',
- expandIconClass: "esri-icon-layer-list"
- });
- view.ui.add(legendExpand,"top-left");
- var bg = new BasemapGallery({
- view: view,
- container: document.createElement('div'),
- });
- var bgExpand = new Expand({
- view: view,
- content: bg.domNode,
- container: 'basemapDiv',
- expandIconClass: "esri-icon-basemap"
- });
- view.ui.add(bgExpand,"top-left");
- var home = new Home({
- view: view
- });
- view.ui.add(home, "top-left");
- var locate = new Locate({
- view: view
- });
- view.ui.add(locate, "top-left");
- var print = new Print({
- view: view,
- container: document.createElement('div'),
- printServiceUrl: "https://xxxxxxxx/arcgis/rest/services/PrintLayout/PrintLayout/GPServer/Export%20Web%20Map"
- });
- var printExpand = new Expand({
- view: view,
- content: print.domNode,
- container: 'printDiv',
- expandIconClass: "esri-icon-printer"
- });
- view.ui.add(printExpand,"top-left");
- var search = new Search({
- view: view,
- container: 'searchDiv',
- allPlaceholder: 'Enter Address or Parcel Number',
- sources: [
- {
- locator: new Locator({ url: "//geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer" }),
- singleLineFieldName: "SingleLine",
- name: "ESRI World Address Geocoder",
- localSearchOptions: {
- minScale: 300000,
- distance: 50000
- },
- placeholder: "Search Geocoder",
- maxResults: 3,
- maxSuggestions: 6,
- suggestionsEnabled: true,
- minSuggestCharacters: 0
- },
- {
- featureLayer: new FeatureLayer({
- url: "https://xxxxxxxxx/arcgis/rest/services/xxxxxxxxx/xxxxxxxxxx/MapServer/18",
- outFields: ['*']
- }),
- searchFields: ['PIN','OWNAM1'],
- displayField: 'PIN',
- exactMatch: false,
- outFields: ['*'],
- name: 'Parcels: xxxxxxxx County',
- placeholder: 'G029001000800',
- maxResults: 6,
- maxSuggestions: 6,
- suggestionsEnabled: true,
- minSuggestCharacters: 0
- },
- {
- featureLayer: new FeatureLayer({
- url: "https://xxxxxxxxxxx/arcgis/rest/services/xxxxxxxxxxxxx/xxxxxxxxxxxxxxx/MapServer/19",
- outFields: ['*']
- }),
- searchFields: ['ParcelNumb_1'],
- displayField: 'ParcelNumb_1',
- exactMatch: false,
- outFields: ['*'],
- name: 'Parcels: xxxxxxxxxxxxxxx County',
- placeholder: '9-04-05-031.00',
- maxResults: 6,
- maxSuggestions: 6,
- suggestionsEnabled: true,
- minSuggestCharacters: 0
- }]
- });
- view.ui.add(search,"top-left");
- var layerlist = new LayerList({
- view: view,
- container: document.createElement('div')
- });
- var layerExpand = new Expand({
- view: view,
- content: layerlist.domNode,
- container: 'layerlistDiv',
- expandIconClass: "esri-icon-layers"
- });
- view.ui.add(layerExpand, "top-left");
- var scaleBar = new ScaleBar({
- view: view,
- style: 'ruler'
- });
- view.ui.add(scaleBar,'bottom-left');
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement