Skip to content

Instantly share code, notes, and snippets.

@kflaw
Last active December 10, 2015 17:18
Show Gist options
  • Save kflaw/3038d09ddbc09136ee36 to your computer and use it in GitHub Desktop.
Save kflaw/3038d09ddbc09136ee36 to your computer and use it in GitHub Desktop.
viewer_ROW_test
define([
'esri/units',
'esri/geometry/Extent',
'esri/config',
'esri/tasks/GeometryService',
'esri/layers/ImageParameters'
//,"esri/layers/ImageServiceParameters"
], function (units, Extent, esriConfig, GeometryService, ImageParameters) {//,ImageServiceParameters) {
// 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://sv04gis: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';
//var params = new ImageServiceParameters();
//params.noData = 0;
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: {
center: [-122.39, 37.852],
basemap: 'satellite',
zoom: 9,
sliderStyle: 'small',
lods: [
{
'level' : 0,
'resolution': 156543.03392800014,
'scale' : 591657527.591555
},
{
'level' : 1,
'resolution': 78271.51696399994,
'scale' : 295828763.795777
},
{
'level' : 2,
'resolution': 39135.75848200009,
'scale' : 147914381.897889
},
{
'level' : 3,
'resolution': 19567.87924099992,
'scale' : 73957190.948944
},
{
'level' : 4,
'resolution': 9783.93962049996,
'scale' : 36978595.474472
},
{
'level' : 5,
'resolution': 4891.96981024998,
'scale' : 18489297.737236
},
{
'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.14929107082380833,
'scale' : 564.248588
},
{
'level' : 21,
'resolution': 0.07464553541190416,
'scale' : 282.124294
},
]
},
panes: {
bottom: {
id: 'sidebarBottom',
placeAt: 'outer',
splitter: true,
collapsible: true,
region: 'bottom',
open: 'none',
style: 'height:200px;',
content: '<div id="attributesContainer"></div>'
}
},
// 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: 'dynamic',
url: 'http://sv04gis:6080/arcgis/rest/services/BaseLayers/D4_Postmiles_and_ROW/MapServer',
title: 'District 4',
slider: true,
noLegend: false,
collapsed: false,
sublayerToggle: false, //true to automatically turn on sublayers
options: {
id: 'PMandROW',
opacity: 1.0,
visible: true,
imageParameters: imageParameters
},
layerControlLayerInfos: {
swipe: true,
metadataUrl: true,
expanded: true,
},
identifyLayerInfos: {
layerIds: []
},
legendLayerInfos: {
layerInfo: {
hideLayers: []
}
}
},
{
type: 'dynamic',
url: 'http://sv04gis:6080/arcgis/rest/services/ROW/MapIndex/MapServer',
title: 'Records',
slider: true,
noLegend: false,
collapsed: false,
sublayerToggle: false, //true to automatically turn on sublayers
options: {
id: 'mapSets',
opacity: 1.0,
visible: true,
imageParameters: imageParameters
},
identifyLayerInfos: {
layerIds: [2,3,4,5,6,8,9,10,11,14,15,16,18,19,20,22,23,24,26,27,28,30,31,32,33,35,36,37,38,40,41,42,43,45]
},
layerControlLayerInfos: {
swipe: true,
metadataUrl: true,
expanded: true,
},
legendLayerInfos: {
layerInfo: {
hideLayers: [12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45]
}
}
// },
// {
// type: 'feature',
// url: 'http://sv04esri:6080/arcgis/rest/services/ROW/MapIndexFS/FeatureServer/0',
// title: 'Map Sheets',
// options: {
// id: 'mapSetsFS',
// opacity: 1.0,
// visible: false,
// outFields: ['*'],
// mode: 1
// }
}],
// set include:true to load. For titlePane type set position the the desired order in the sidebar
widgets: {
search: {
include: true,
id: 'search',
type: 'titlePane',
path: 'gis/dijit/Search',
canFloat: true,
title: 'Search Parcel Ledger Database',
open: false,
position: 0,
options: 'config/search_ROW'
},
attributesTable: {
include: true,
id: 'attributesContainer',
type: 'domNode',
srcNodeRef: 'attributesContainer',
path: 'gis/dijit/AttributesTable',
options: {
map: true,
mapClickMode: true,
// use a tab container for multiple tables or
// show only a single table
useTabs: false,
// used to open the sidebar after a query has completed
sidebarID: 'sidebarBottom'
}
},
growler: {
include: true,
id: 'growler',
type: 'domNode',
path: 'gis/dijit/Growler',
srcNodeRef: 'growlerDijit',
options: {}
},
share: {
include: true,
id: 'share',
type: 'floating',
path: 'gis/dijit/Share',
title: 'Share This Map',
options: {
map: true
}
},
geocoder: {
include: true,
id: 'geocoder',
type: 'domNode',
path: 'gis/dijit/Geocoder',
srcNodeRef: 'geocodeDijit',
options: {
map: true,
mapRightClickMenu: true,
geocoderOptions: {
autoComplete: true,
arcgisGeocoder:{
placeholder: 'Select Geocoder'
},
geocoderMenu: true,
geocoders: [{
url: "http://sv04gis:6080/arcgis/rest/services/ROW/sde_Postmile_Locator/GeocodeServer",
name: "Postmile Geocoder",
placeholder: 'ex. ALA 580 R37'
}],
placeholder: "Find address or place"
//value: "ALA 84 10.2"
}
}
},
identify: {
include: true,
id: 'identify',
type: 'titlePane',
path: 'gis/dijit/Identify_ROW',
title: 'Identify Features',
open: false,
position: 5,
options: 'config/identify_ROW'
},
basemaps: {
include: true,
id: 'basemaps',
type: 'domNode',
path: 'gis/dijit/Basemaps',
srcNodeRef: 'basemapsDijit',
options: 'config/basemaps_ROW'
},
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: -123.533596520759,
ymin: 36.893112958237,
xmax: -121.208054065341,
ymax: 38.8640702786552,
spatialReference: {
wkid: 4326
}
})
}
},
legend: {
include: true,
id: 'legend',
type: 'titlePane',
path: 'esri/dijit/Legend',
title: 'Legend',
open: true,
position: 1,
options: {
map: true,
legendLayerInfos: true
}
},
layerControl: {
include: true,
id: 'layerControl',
type: 'titlePane',
path: 'gis/dijit/LayerControl',
title: 'Layers',
open: true,
position: 0,
options: {
map: true,
layerControlLayerInfos: true,
separated: true,
vectorReorder: true,
overlayReorder: true
}
},
bookmarks: {
include: true,
id: 'bookmarks',
type: 'titlePane',
path: 'gis/dijit/Bookmarks',
title: 'Bookmarks',
open: false,
position: 4,
options: 'config/bookmarks'
},
find: {
include: true,
id: 'find',
type: 'titlePane',
canFloat: true,
path: 'gis/dijit/Find',
title: 'Find a Map Sheet or Parcel',
open: false,
position: 2,
options: 'config/find_ROW'
},
draw: {
include: true,
id: 'draw',
type: 'titlePane',
canFloat: true,
path: 'gis/dijit/Draw',
title: 'Draw',
open: false,
position: 7,
options: {
map: true,
mapClickMode: true
}
},
measure: {
include: true,
id: 'measurement',
type: 'titlePane',
canFloat: true,
path: 'gis/dijit/Measurement',
title: 'Measurement',
open: false,
position: 6,
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: 8,
options: {
map: true,
printTaskURL: 'http://sv04gis:6080/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task',
//copyrightText: 'Copyright 2015',
// authorText: '',
defaultTitle: 'D4 | CTrip',
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: true,
id: 'streetview',
type: 'titlePane',
canFloat: true,
position: 9,
path: 'gis/dijit/StreetView',
title: 'Google Street View',
options: {
map: true,
mapClickMode: true,
mapRightClickMenu: true
}
},
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