This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
geocodeAddress: function (data) { | |
console.log('Geocoder called with ' + data); | |
//although there is a dijit that can do this search | |
//it's just a simple ajax call, so we will just use jquery | |
var url = 'http://geocode.arcgis.com/arcgis/rest/services/World/GeocodeServer/find'; | |
this.layout.showSpinner(); | |
$.ajax(url, { | |
data: { | |
text: data, | |
f: 'json', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
geocodeResultsHandler:function(data,status,jqXHR){ | |
console.log('Got Geocode Results...'); | |
console.dir(data); | |
//get the count returned | |
var foundCount = data.locations.length; | |
if(foundCount === 1){ | |
var loc = data.locations[0]; | |
//hide the ui and zoom to the location | |
//create a simple point Object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initBaseLayers: function (basemaps) { | |
console.log('Map:Controller:initBaseLayers'); | |
_.each(basemaps, function(layer){ | |
switch(layer.type){ | |
case 'ArcGISTiledMapServiceLayer': | |
var lyr = new esri.layers.ArcGISTiledMapServiceLayer(layer.url, | |
{ | |
id: 'basemap_' + layer.label, | |
visible: layer.visible | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global gmm */ | |
if (!this.gmm || typeof this.gmm !== 'object') { | |
this.gmm = {}; | |
} | |
(function () { | |
'use strict'; | |
gmm.Viewer.module('RouterModule', function (Mod, Viewer, Backbone, Marionette, $, _) { | |
//================================== | |
//initializer called on Viewer.start(options) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
initMap: function (mapConfig) { | |
console.log('Map:Controller:initMap'); | |
var initialExtent = new esri.geometry.Extent(mapConfig.initialExtent); | |
this.map = new esri.Map("map", { | |
extent: initialExtent, | |
maxZoom: 15 | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
url:'http://wildfire.cr.usgs.gov/ArcGIS/rest/services/geomac_dyn/MapServer', | |
model: | |
{ | |
name:'2012 Fires', | |
layerId:7, | |
perimeterLayerId:18, | |
defn:"year_='2012'" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getFireLayerDefinition: function(){ | |
var defn = { | |
"geometryType": "esriGeometryPoint", | |
"objectIdField": "objectid", | |
"spatialReference":{"wkid":102100}, | |
"drawingInfo": { | |
"renderer": { | |
"type": "simple", | |
"symbol": { | |
"type": "esriPMS", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
showFires:function(featureArray){ | |
//remove the firelayer if it's in the map | |
var lyr = this.map.getLayer("fireLayer"); | |
if(lyr){ | |
this.map.removeLayer(lyr); | |
} | |
//setup the definition for the layer | |
//this includes the renderer | |
var layerDefinition = this.getFireLayerDefinition(); | |
var featureCollection = { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
onMapLoaded:function(){ | |
//ok, now that we have a map we can link up some events | |
Viewer.vent.on('FireLayer:ConfigChanged',this.setYear); | |
//and if we have values passed in on the url, raise events | |
if(this.urlValues){ | |
Viewer.vent.trigger('FireLayer:ConfigChanged', this.urlValues.yearData); | |
Viewer.vent.trigger('Map:ShowPerimeters',this.urlValues.yearData); | |
Viewer.vent.trigger('Navbar:ChangeItemName',this.urlValues.yearData.model.name); | |
Viewer.vent.trigger('Map:CenterAtLatLongAndZoom', { | |
x:this.urlValues.x, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//NOTE THIS IS A SNIPPET OF CODE! IT WILL NOT RUN LIKE THIS! STUFF IT INTO A CLASS | |
IFeatureClass featureClass = Helper.OpenFromFGDB(@"C:\data\Historical_Routes.gdb", fcName); | |
Type t = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment"); | |
System.Object obj = Activator.CreateInstance(t); | |
ISpatialReferenceFactory srFact = obj as ISpatialReferenceFactory; | |
IProjectedCoordinateSystem webMercatorSR = srFact.CreateProjectedCoordinateSystem((int)esriSRProjCS2Type.esriSRProjCS_WGS1984SphereWebMercator); | |
IQueryFilter queryFilter = new QueryFilterClass(); |