Skip to content

Instantly share code, notes, and snippets.

@kcarrier
Created December 21, 2015 18:58
Show Gist options
  • Save kcarrier/c2671b725a928eea0a91 to your computer and use it in GitHub Desktop.
Save kcarrier/c2671b725a928eea0a91 to your computer and use it in GitHub Desktop.
define([
'esri/units',
'esri/geometry/Extent',
'esri/config',
'esri/tasks/GeometryService',
'esri/layers/ImageParameters',
'esri/dijit/Basemap',
'esri/dijit/BasemapLayer',
'esri/symbols/PictureMarkerSymbol'
], function (units, Extent, esriConfig, GeometryService, ImageParameters, Basemap, BasemapLayer, PictureMarkerSymbol) {
// url to your proxy page, must be on same machine hosting you app. See proxy folder for readme.
esriConfig.defaults.io.proxyUrl = 'proxy/proxy.ashx';
esriConfig.defaults.io.alwaysUseProxy = false;
// url to your geometry server.
esriConfig.defaults.geometryService = new GeometryService('http://maps1.croppermap.com:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer');
//image parameters for dynamic services, set to png32 for higher quality exports.
var imageParameters = new ImageParameters();
imageParameters.format = 'png32';
return {
// used for debugging your app
isDebug: false,
//default mapClick mode, mapClickMode lets widgets know what mode the map is in to avoid multipult map click actions from taking place (ie identify while drawing).
defaultMapClickMode: 'identify',
// map options, passed to map constructor. see: https://developers.arcgis.com/javascript/jsapi/map-amd.html#map1
mapOptions: {
basemap: new Basemap({
layers: [new BasemapLayer({
url: 'http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer',
displayLevels: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]
})]
}),
navigationMode: 'classic',
center: [-79.799504, 32.850450],
zoom: 10,
sliderStyle: 'small',
lods: [{
'level': 0,
'resolution': 156543.03392800014,
'scale': 5.91657527591555E8
}, {
'level': 1,
'resolution': 78271.51696399994,
'scale': 2.95828763795777E8
}, {
'level': 2,
'resolution': 39135.75848200009,
'scale': 1.47914381897889E8
}, {
'level': 3,
'resolution': 19567.87924099992,
'scale': 7.3957190948944E7
}, {
'level': 4,
'resolution': 9783.93962049996,
'scale': 3.6978595474472E7
}, {
'level': 5,
'resolution': 4891.96981024998,
'scale': 1.8489297737236E7
}, {
'level': 6,
'resolution': 2445.98490512499,
'scale': 9244648.868618
}, {
'level': 7,
'resolution': 1222.992452562495,
'scale': 4622324.434309
}, {
'level': 8,
'resolution': 611.4962262813797,
'scale': 2311162.217155
}, {
'level': 9,
'resolution': 305.74811314055756,
'scale': 1155581.108577
}, {
'level': 10,
'resolution': 152.87405657041106,
'scale': 577790.554289
}, {
'level': 11,
'resolution': 76.43702828507324,
'scale': 288895.277144
}, {
'level': 12,
'resolution': 38.21851414253662,
'scale': 144447.638572
}, {
'level': 13,
'resolution': 19.10925707126831,
'scale': 72223.819286
}, {
'level': 14,
'resolution': 9.554628535634155,
'scale': 36111.909643
}, {
'level': 15,
'resolution': 4.77731426794937,
'scale': 18055.954822
}, {
'level': 16,
'resolution': 2.388657133974685,
'scale': 9027.977411
}, {
'level': 17,
'resolution': 1.1943285668550503,
'scale': 4513.988705
}, {
'level': 18,
'resolution': 0.5971642835598172,
'scale': 2256.994353
}, {
'level': 19,
'resolution': 0.29858214164761665,
'scale': 1128.497176
}]
},
// panes: {
// left: {
// splitter: true
// },
// right: {
// id: 'sidebarRight',
// placeAt: 'outer',
// region: 'right',
// splitter: true,
// collapsible: true
// },
// bottom: {
// id: 'sidebarBottom',
// placeAt: 'outer',
// splitter: true,
// collapsible: true,
// region: 'bottom'
// },
// top: {
// id: 'sidebarTop',
// placeAt: 'outer',
// collapsible: true,
// splitter: true,
// region: 'top'
// }
// },
// collapseButtonsPane: 'center', //center or outer
// operationalLayers: Array of Layers to load on top of the basemap: valid 'type' options: 'dynamic', 'tiled', 'feature'.
// The 'options' object is passed as the layers options for constructor. Title will be used in the legend only. id's must be unique and have no spaces.
// 3 'mode' options: MODE_SNAPSHOT = 0, MODE_ONDEMAND = 1, MODE_SELECTION = 2
//
operationalLayers: [{
type: 'feature',
url: 'http://maps2.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_Query_Service_150605/MapServer/2',
title: 'Query Layer',
collapsed: true,
options: {
id: 'qrylyr',
opacity: 0,
mode: 1
},
layerControlLayerInfos: {
sublayers: false,
noLegend: true,
exclude: true
}
}, {
type: 'dynamic',
url: 'http://maps3.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_ES_Labels_151215/MapServer',
title: 'ES Boundary Labels',
collapsed: true,
options: {
id: 'labelsES',
opacity: 1,
visible: true,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true
//layerIds: [5, 6, 7, 8, 9, 10, 11, 12]
},
layerControlLayerInfos: {
sublayers: false,
noLegend: true,
exclude: true
}
}, {
type: 'dynamic',
url: 'http://maps4.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_MS_Labels_151215/MapServer',
title: 'MS Boundary Labels',
collapsed: true,
options: {
id: 'labelsMS',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true
//layerIds: [5, 6, 7, 8, 9, 10, 11, 12]
},
layerControlLayerInfos: {
sublayers: false,
noLegend: true,
exclude: true
}
}, {
type: 'dynamic',
url: 'http://maps5.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_HS_Labels_151215r2/MapServer',
title: 'HS Boundary Labels',
collapsed: true,
options: {
id: 'labelsHS',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true
//layerIds: [5, 6, 7, 8, 9, 10, 11, 12]
},
layerControlLayerInfos: {
sublayers: false,
noLegend: true,
exclude: true
}
}, {
type: 'tiled',
url: 'http://maps6.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_Elementary_Basemap_151128_clipped/MapServer',
title: 'Elementary Schools',
collapsed: true,
options: {
id: 'elementaryschools',
opacity: 1,
visible: true,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true
},
layerControlLayerInfos: {
sublayers: false,
noLegend: true
}
}, {
type: 'tiled',
url: 'http://maps7.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_Middle_Basemap_151204_clipped/MapServer',
title: 'Middle Schools',
options: {
id: 'middleschools',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true //layerIds: [5, 6, 7, 8, 9, 10, 11, 12]
},
layerControlLayerInfos: {
sublayers: false,
noLegend: true
}
}, {
type: 'tiled',
url: 'http://maps8.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_High_Basemap_151207_clipped/MapServer',
title: 'High Schools',
options: {
id: 'highschools',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true //layerIds: [5, 6, 7, 8, 9, 10, 11, 12]
},
layerControlLayerInfos: {
sublayers: false,
noLegend: true
}
}, {
type: 'tiled',
url: 'http://maps9.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_All_Schools_Basemap_151209_clipped/MapServer',
title: 'All Schools',
options: {
id: 'allschools',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true //layerIds: [5, 6, 7, 8, 9, 10, 11, 12]
},
layerControlLayerInfos: {
sublayers: false,
noLegend: true
}
}],
// set include:true to load. For titlePane type set position the the desired order in the sidebar
widgets: {
growler: {
include: true,
id: 'growler',
type: 'domNode',
path: 'gis/dijit/Growler',
srcNodeRef: 'growlerDijit',
options: {}
},
//geocoder: {
// include: true,
// id: 'geocoder',
// type: 'domNode',
// path: 'gis/dijit/Geocoder',
// srcNodeRef: 'geocodeDijit',
// options: {
// map: true,
// mapRightClickMenu: true,
// geocoderOptions: {
// autoComplete: true,
// arcgisGeocoder: false, //if true a pick list showing your custom geocoder(s) below and the ESRI widget will appear for the end user to select
// zoomScale: 1000,
// suggest: true,
// highlightLocation: true,
// showResults: true,
// placeholder: 'Search for an address',
// // name below will appear in widget pick list if arcgisGeocoder:true
// geocoders: [{
// url: 'http://67.154.191.149:6080/arcgis/rest/services/Charleston/Charleston_Composite_151130/GeocodeServer',
// name: 'My Address Points',
// suggest: true,
// autoComplete: true
// }]
// }
// }
//},
geocoder: {
include: true,
id: 'geocoder',
type: 'domNode',
path: 'gis/dijit/Geocoder',
//srcNodeRef: 'geocodeDijit',
srcNodeRef: 'geocoderButton',
options: {
map: true,
mapRightClickMenu: true,
expanded: true,
collapsible: true,
geocoderOptions: {
//autoComplete: true,
arcgisGeocoder: false, //if true a pick list showing your custom geocoder(s) below and the ESRI widget will appear for the end user to select
zoomScale: 1000,
//suggest: true,
placeholder: 'Search for an address',
highlightLocation: true,
showResults: true,
symbol: new PictureMarkerSymbol({
angle: 15,
xoffset: -12,
yoffset: 24,
type: 'esriPMS',
url: 'http://static.arcgis.com/images/Symbols/Basic/RedFlag.png',
contentType: 'image/png',
width: 18,
height: 18
}),
geocoders: [{
url: 'http://maps20.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_Composite_151216/GeocodeServer',
name: 'My Address Points',
autoComplete: true,
zoomScale: 1000,
suggest: true,
singleLineFieldName: 'SingleLine'
}]
}
}
},
//geocoder: {
// include: true,
// id: 'geocoder',
// type: 'domNode',
// path: 'gis/dijit/Geocoder',
// srcNodeRef: 'geocoderButton',
// options: {
// map: true,
// mapRightClickMenu: true,
// expanded: true,
// collapsible: true,
// geocoderOptions: {
// autoComplete: true,
// suggest: true,
// highlightLocation: true,
// showResults: true,
// symbol: new PictureMarkerSymbol({
// angle: 15,
// xoffset: -12,
// yoffset: 24,
// type: 'esriPMS',
// url: 'http://static.arcgis.com/images/Symbols/Basic/RedFlag.png',
// contentType: 'image/png',
// width: 18,
// height: 18
// }),
// arcgisGeocoder: {
// searchExtent: new Extent({
// xmin: -8959073.0313,
// ymin: 3825003.1199,
// xmax: -8820273.8583,
// ymax: 3926665.3904,
// spatialReference: {
// wkid: 102100
// }
// })
// }
// }
// }
//},
identify: {
include: true,
id: 'identify',
type: 'invisible',
path: 'gis/dijit/Identify',
title: 'Identify',
open: false,
//position: 3,
options: 'config/identify'
},
layerReactor: {
include: true,
id: 'layerReactor',
type: 'invisible',
path: 'gis/dijit/layerReactor',
options: {
map: true
}
},
basemaps: {
include: true,
id: 'basemaps',
type: 'domNode',
path: 'gis/dijit/Basemaps',
srcNodeRef: 'basemapsDijit',
options: 'config/basemaps'
},
mapInfo: {
include: false,
id: 'mapInfo',
type: 'domNode',
path: 'gis/dijit/MapInfo',
srcNodeRef: 'mapInfoDijit',
options: {
map: true,
mode: 'dms',
firstCoord: 'y',
unitScale: 3,
showScale: true,
xLabel: '',
yLabel: '',
minWidth: 286
}
},
scalebar: {
include: true,
id: 'scalebar',
type: 'map',
path: 'esri/dijit/Scalebar',
options: {
map: true,
attachTo: 'bottom-left',
scalebarStyle: 'line',
scalebarUnit: 'dual'
}
},
locateButton: {
include: true,
id: 'locateButton',
type: 'domNode',
path: 'gis/dijit/LocateButton',
srcNodeRef: 'locateButton',
options: {
map: true,
publishGPSPosition: true,
highlightLocation: true,
useTracking: true,
geolocationOptions: {
maximumAge: 0,
timeout: 15000,
enableHighAccuracy: true
}
}
},
overviewMap: {
include: true,
id: 'overviewMap',
type: 'map',
path: 'esri/dijit/OverviewMap',
options: {
map: true,
attachTo: 'bottom-right',
color: '#0000CC',
height: 100,
width: 125,
opacity: 0.30,
visible: false
}
},
homeButton: {
include: true,
id: 'homeButton',
type: 'domNode',
path: 'esri/dijit/HomeButton',
srcNodeRef: 'homeButton',
options: {
map: true,
extent: new Extent({
xmin: -8959073.0313,
ymin: 3825003.1199,
xmax: -8820273.8583,
ymax: 3926665.3904,
spatialReference: {
wkid: 102100
}
})
}
},
legend: {
include: false,
id: 'legend',
type: 'titlePane',
path: 'esri/dijit/Legend',
title: 'Legend',
open: false,
position: 0,
options: {
map: true,
legendLayerInfos: true
}
},
layerControl: {
include: true,
id: 'layerControl',
type: 'titlePane',
path: 'gis/dijit/LayerControl',
title: 'View School Zones',
open: false,
position: 0,
options: {
map: true,
layerControlLayerInfos: true,
separated: true,
vectorReorder: true,
overlayReorder: true
}
},
bookmarks: {
include: false,
id: 'bookmarks',
type: 'titlePane',
path: 'gis/dijit/Bookmarks',
title: 'Bookmarks',
open: false,
position: 2,
options: 'config/bookmarks'
},
find: {
include: false,
id: 'find',
type: 'titlePane',
canFloat: true,
path: 'gis/dijit/Find',
title: 'Find',
open: false,
position: 3,
options: 'config/find'
},
draw: {
include: false,
id: 'draw',
type: 'titlePane',
canFloat: true,
path: 'gis/dijit/Draw',
title: 'Draw',
open: false,
position: 4,
options: {
map: true,
mapClickMode: true
}
},
measure: {
include: false,
id: 'measurement',
type: 'titlePane',
canFloat: true,
path: 'gis/dijit/Measurement',
title: 'Measurement',
open: false,
position: 5,
options: {
map: true,
mapClickMode: true,
defaultAreaUnit: units.SQUARE_MILES,
defaultLengthUnit: units.MILES
}
},
print: {
include: true,
id: 'print',
type: 'titlePane',
canFloat: true,
path: 'gis/dijit/Print',
title: 'Print',
open: false,
position: 6,
options: {
map: true,
printTaskURL: 'http://maps10.croppermap.com:6080/arcgis/rest/services/Charleston/CharlestonPrintTemplate/GPServer/Export%20Web%20Map',
copyrightText: '',
authorText: '',
defaultTitle: '',
defaultFormat: 'PDF'
//defaultLayout: 'Letter ANSI A Landscape'
}
},
directions: {
include: false,
id: 'directions',
type: 'titlePane',
path: 'gis/dijit/Directions',
title: 'Directions',
open: false,
position: 7,
options: {
map: true,
mapRightClickMenu: true,
options: {
routeTaskUrl: 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Network/USA/NAServer/Route',
routeParams: {
directionsLanguage: 'en-US',
directionsLengthUnits: units.MILES
},
active: false //for 3.12, starts active by default, which we dont want as it interfears with mapClickMode
}
}
},
editor: {
include: false,
id: 'editor',
type: 'titlePane',
path: 'gis/dijit/Editor',
title: 'Editor',
open: false,
position: 8,
options: {
map: true,
mapClickMode: true,
editorLayerInfos: true,
settings: {
toolbarVisible: true,
showAttributesOnClick: true,
enableUndoRedo: true,
createOptions: {
polygonDrawTools: ['freehandpolygon', 'autocomplete']
},
toolbarOptions: {
reshapeVisible: true,
cutVisible: true,
mergeVisible: true
}
}
}
},
streetview: {
include: false,
id: 'streetview',
type: 'titlePane',
canFloat: true,
position: 9,
path: 'gis/dijit/StreetView',
title: 'Google Street View',
options: {
map: true,
mapClickMode: true,
mapRightClickMenu: true
}
},
zoomToFeature: {
include: true,
id: 'zoomToFeature',
type: 'titlePane',
title: 'Zoom To School Zones',
position: 0,
open: false,
path: 'gis/dijit/ZoomToFeatureSZ',
options: {
map: true,
url: 'http://maps11.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_Query_Service_150605/MapServer/5',
field: 'NAME',
where: '1=1',
// you can customize the text
i18n: {
selectFeature: 'Select A School Zone'
}
}
},
zoomToFeature2: {
include: true,
id: 'zoomToFeature2',
type: 'titlePane',
title: 'Zoom To Charter Schools',
position: 0,
open: false,
path: 'gis/dijit/ZoomToFeatureSZ',
options: {
map: true,
url: 'http://maps12.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_Query_Service_150605/MapServer/0',
field: 'NAME',
where: '1=1',
// you can customize the text
i18n: {
selectFeature: 'Select A Charter School'
}
}
},
zoomToFeature3: {
include: true,
id: 'zoomToFeature3',
type: 'titlePane',
title: 'Zoom To Magnet Schools',
position: 0,
open: false,
path: 'gis/dijit/ZoomToFeatureSZ',
options: {
map: true,
url: 'http://maps13.croppermap.com:6080/arcgis/rest/services/Charleston/Charleston_Query_Service_150605/MapServer/1',
field: 'NAME',
where: '1=1',
// you can customize the text
i18n: {
selectFeature: 'Select A Magnet School'
}
}
},
//buffer: {
// include: true,
// id: 'buffer',
// type: 'titlePane',
// path: 'gis/dijit/Search',
// canFloat: true,
// title: 'Buffer',
// open: false,
// position: 0,
// options: 'config/buffer'
//},
help: {
include: true,
id: 'help',
type: 'floating',
path: 'gis/dijit/Help',
title: 'Help',
options: {}
}
}
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment