Skip to content

Instantly share code, notes, and snippets.

@kcarrier
Created December 16, 2015 17:27
Show Gist options
  • Save kcarrier/43e9d816fc585d9faa77 to your computer and use it in GitHub Desktop.
Save kcarrier/43e9d816fc585d9faa77 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/urlUtils'
], function (units, Extent, esriConfig, GeometryService, ImageParameters, Basemap, BasemapLayer, urlUtils) {
// 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;
esriConfig.defaults.io.timeout = 120000;
// url to your geometry server.
esriConfig.defaults.geometryService = new GeometryService('http://maps1.clermontauditor.org/arcgis/rest/services/Utilities/Geometry/GeometryServer');
urlUtils.addProxyRule({
urlPrefix: 'maps.clermontcountyohio.gov',
proxyUrl: '/proxy/proxy.ashx'
});
urlUtils.addProxyRule({
urlPrefix: 'maps18.clermontauditor.org',
proxyUrl: '/proxy/proxy.ashx'
});
//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_Imagery/MapServer'
})]
}),
navigationMode: 'classic',
center: [-84.138794, 39.055701],
zoom: 11,
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
}, {
'level': 20,
'resolution': 0.158750317500635,
'scale': 600
}, {
'level': 21,
'resolution': 0.0793751587503175,
'scale': 300
}]
},
operationalLayers: [{
type: 'dynamic',
url: 'http://maps2.clermontauditor.org/arcgis/rest/services/Parcels/AddressPointsLabeled/MapServer',
title: 'Address Points',
noLegend: true,
collapsed: true,
options: {
id: 'address',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true //layerIds: [5, 6, 7, 8, 9, 10, 11, 12]
},
layerControlLayerInfos: {
sublayers: false
}
}, {
type: 'dynamic',
url: 'http://maps3.clermontauditor.org/arcgis/rest/services/WMAS/Monuments/MapServer',
title: 'Monuments',
noLegend: true,
collapsed: true,
options: {
id: 'monuments',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
layerIds: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]
},
layerControlLayerInfos: {
sublayers: false
}
}, {
type: 'dynamic',
url: 'http://maps4.clermontauditor.org/arcgis/rest/services/WMAS/ParSurveys/MapServer',
title: 'Survey Points',
noLegend: true,
collapsed: true,
options: {
id: 'surveypoints',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
layerIds: [0, 1, 2, 3, 4, 5, 6, 7, 8]
},
layerControlLayerInfos: {
sublayers: false
}
}, {
type: 'dynamic',
url: 'http://maps5.clermontauditor.org/arcgis/rest/services/Sales/ParSales/MapServer',
title: 'Property Sales',
noLegend: true,
collapsed: true,
options: {
id: 'parcelsales',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true //layerIds: [5, 6, 7, 8, 9, 10, 11, 12]
},
layerControlLayerInfos: {
sublayers: false
}
}, {
type: 'dynamic',
url: 'http://maps6.clermontauditor.org/arcgis/rest/services/WMAS/Townships/MapServer',
title: 'Townships',
noLegend: true,
collapsed: true,
options: {
id: 'township',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: true
}
}, {
type: 'dynamic',
url: 'http://maps7.clermontauditor.org/arcgis/rest/services/WMAS/SchoolDistricts/MapServer',
title: 'School Districts',
noLegend: true,
collapsed: true,
options: {
id: 'schooldistricts',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: true
}
}, {
type: 'dynamic',
url: 'http://maps.clermontcountyohio.gov/gisweb/rest/services/WMAS/WS_Layers_WMAS/MapServer',
title: 'Water and Sewer',
noLegend: true,
collapsed: true,
options: {
id: 'waterandsewer',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
layerIds: [1, 2, 3, 4, 6, 7, 8, 10, 11, 12, 14, 15, 16, 17, 19, 20, 21, 23, 24, 25, 26, 28, 29, 30, 32, 33, 34, 35, 37, 38, 39, 41, 42, 43, 44, 46, 47, 48, 50, 51, 52, 53]
},
layerControlLayerInfos: {
sublayers: false
}
}, {
type: 'dynamic',
url: 'http://maps8.clermontauditor.org/arcgis/rest/services/WMAS/VMS/MapServer',
title: 'Virginia Military Survey',
noLegend: true,
collapsed: true,
options: {
id: 'vms',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: true
}
}, {
type: 'tiled',
url: 'http://maps9.clermontauditor.org/arcgis/rest/services/WMAS/Subdivisions/MapServer',
title: 'Subdivisions',
noLegend: true,
collapsed: true,
options: {
id: 'subdivisions',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: true
}
}, {
type: 'dynamic',
url: 'http://maps10.clermontauditor.org/arcgis/rest/services/Parcels/ParcelLabelsWMAS/MapServer',
title: 'Parcel Labels',
noLegend: true,
collapsed: true,
options: {
id: 'parcellabels',
opacity: 1,
visible: true,
imageParameters: imageParameters
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: true
}
}, {
type: 'tiled',
url: 'http://maps11.clermontauditor.org/arcgis/rest/services/WMAS/Hybrid/MapServer',
title: 'Roads',
noLegend: true,
collapsed: true,
options: {
id: 'roads',
opacity: 1,
visible: true,
imageParameters: imageParameters
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: true
}
}, {
type: 'dynamic',
url: 'http://maps12.clermontauditor.org/arcgis/rest/services/WMAS/BuildingFootprints/MapServer',
title: 'Building Footprints',
noLegend: true,
collapsed: true,
options: {
id: 'buildingfootprints',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
exclude: true
},
layerControlLayerInfos: {
sublayers: false
}
}, {
type: 'dynamic',
url: 'http://maps13.clermontauditor.org/arcgis/rest/services/Parcels/Parcels_WMAS_Dynamic/MapServer',
title: 'Parcels',
noLegend: true,
collapsed: true,
options: {
id: 'parcels',
opacity: 1,
visible: true,
imageParameters: imageParameters
},
identifyLayerInfos: {
layerIds: [1,2,3,4,5,6,7]
},
layerControlLayerInfos: {
sublayers: false
}
}, {
type: 'dynamic',
url: 'http://maps14.clermontauditor.org/arcgis/rest/services/WMAS/LandUseCodes/MapServer',
title: 'Parcels by Land Use Code',
noLegend: true,
collapsed: true,
options: {
id: 'parcelsluc',
opacity: 1,
visible: false,
imageParameters: imageParameters
},
identifyLayerInfos: {
layerIds: [7, 9, 11, 13, 15, 17]
},
layerControlLayerInfos: {
sublayers: false
}
}, {
type: 'tiled',
url: 'http://maps15.clermontauditor.org/arcgis/rest/services/WMAS/Contours/MapServer',
title: 'Contours',
noLegend: true,
collapsed: true,
options: {
id: 'contours',
opacity: 1,
visible: false
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: true
}
}, {
type: 'tiled',
url: 'http://maps16.clermontauditor.org/arcgis/rest/services/WMAS/Hydrology/MapServer',
title: 'Hydrology',
noLegend: true,
collapsed: true,
options: {
id: 'hydrology',
opacity: 1,
visible: false
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: true
}
}, {
type: 'tiled',
url: 'http://maps17.clermontauditor.org/arcgis/rest/services/WMAS/FloodPlain/MapServer',
title: 'Flood Plain',
noLegend: true,
collapsed: true,
options: {
id: 'floodplain',
opacity: 1,
visible: false
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: true
}
}, {
type: 'tiled',
url: 'http://maps18.clermontauditor.org/arcgis/rest/services/WMAS/Soils/MapServer',
title: 'Soils',
noLegend: true,
collapsed: true,
options: {
id: 'soils',
opacity: 1,
visible: false
},
layerControlLayerInfos: {
sublayers: false
},
identifyLayerInfos: {
exclude: 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: false,
id: 'geocoder',
type: 'domNode',
path: 'gis/dijit/Geocoder',
srcNodeRef: 'geocodeDijit',
options: {
map: true,
mapRightClickMenu: true,
geocoderOptions: {
autoComplete: true,
arcgisGeocoder: {
placeholder: 'Enter an address or place'
}
}
}
},
identify: {
include: true,
id: 'identify',
type: 'invisible',
path: 'gis/dijit/Identify',
title: 'Identify',
open: false,
//position: 3,
options: 'config/identify'
},
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, //required
mode: 'map', //'map', 'dec' or 'dms'
firstCoord: 'y', //which coord to display first ('x')
unitScale: 2, //coord decimal places (2)(affects seconds in 'dms' format)
showScale: true, //show map scale (false)
showZoom: false, //show zoom level (false)
xLabel: 'X:', //label for x coord ('X:')
yLabel: 'Y:', //label for y coord ('Y:')
scaleLabel: '1:', //label for map scale ('1:')
zoomLabel: 'Z', //label for zoom level ('Z')
minWidth: 286, //minimum width in pixels of widget (0)(when 0 widget fits content)
proj4Catalog: 'EPSG', //'ESRI', 'EPSG' or 'SR-ORG' **
proj4Wkid: 3857 //wkid of the map ** // 4326
}
},
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: false,
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: -9486001.6397,
ymin: 4646727.883,
xmax: -9251187.0888,
ymax: 4802353.6726,
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: 'Layers',
open: false,
position: 0,
options: {
map: true,
layerControlLayerInfos: true,
separated: true,
vectorReorder: true,
overlayReorder: true,
noLegend: true
}
},
bookmarks: {
include: false,
id: 'bookmarks',
type: 'titlePane',
path: 'gis/dijit/Bookmarks',
title: 'Bookmarks',
open: false,
position: 2,
options: 'config/bookmarks'
},
find: {
include: true,
id: 'find',
type: 'titlePane',
canFloat: true,
path: 'gis/dijit/Find',
title: 'Find',
open: false,
position: 3,
options: 'config/find'
},
draw: {
include: true,
id: 'draw',
type: 'titlePane',
canFloat: true,
path: 'gis/dijit/Draw',
title: 'Draw',
open: false,
position: 4,
options: {
map: true,
mapClickMode: true
}
},
measure: {
include: true,
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://maps18.clermontauditor.org/arcgis/rest/services/PrintTemplates/ExportWebMap/GPServer/Export%20Web%20Map',
copyrightText: '',
authorText: '',
defaultTitle: 'Enter Title Here',
defaultFormat: 'PDF',
defaultLayout: '8.5 x 11 Landscape'
},
exportOptions: {
dpi: 120,
preserveScale: true
}
},
directions: {
include: true,
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: true,
id: 'streetview',
type: 'titlePane',
canFloat: true,
position: 9,
path: 'gis/dijit/StreetView',
title: 'Google Street View',
options: {
map: true,
mapClickMode: true,
mapRightClickMenu: true
}
},
projection: {
include: true,
id: 'projection',
type: 'titlePane',
canFloat: false,
position: 10,
path: 'gis/dijit/Projection',
title: 'Coordinates',
options: {
map: true,
mapClickMode: true,
// optionally specify local projection files location {SRID}.js
// proj4BaseURL: '/local/projections'
projectionList: [
{ title: 'NAD83', srid: 3735},
{ title: 'WGS84', srid: 4326 }
]
}
},
help: {
include: false,
id: 'help',
type: 'floating',
path: 'gis/dijit/Help',
title: 'Help',
options: {}
}
}
};
});
/*
WSViewer 1.1 07/17/2015
01. Recached Streetmap Basemap
02. Added Coordinate widget
03. Moved Roads out of basemaps and into Layers list so it can be toggled on and off.
04. Added VMS service.
05. Added Building Footprint service.
06. Changed Parcels_WMAS_Dynamic symbology.
07. Changed AddressPointsLabeled symbology.
08. Changed ParcelLabelsWMAS symbology.
09. Renamed Clermont County Streets Basemap to Streets.
10. Renamed 2014-2015 Aerials -> Aerial for consistency.
11. Changed Monuments symbology and added labels.
12. All dynamic map services now render as PNG32.
13. Annotation now uses 1 symbol class to simplify changes in the future.
14. Changed Find widget to look at layerID(7)
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment