|
POST
|
I decided I wanted a white border around the scalebar and I got the line to work, but I am still having problems with the labels. I used inspect element and thought that I made the necessary changes in my CSS, but no change. Here is my modified code. <!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } .esriScalebarLine, .esriScalebarMetricLine { border-color:White; } .esriScalebarLabel, .esriScalebarLineLabel,.esriScalebarSecondNumber, .esriScaleLabelDiv { text-shadow:White; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/dijit/Scalebar", "esri/geometry/Extent", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "dojo/dom", "dojo/on", "dojo/parser", "dojo/domReady!"], function (Map, Scalebar, Extent, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, dom, on, parser ) { // declare initial map extent with spatial reference var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435} }); map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent }); // add imagery var tiled = new ArcGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(operationalLayer); var scalebar = new Scalebar({ map: map, scalebarUnit: "dual" }); } ); </script> </head> <body class="soria"> <div id="mapDiv"></div> </body> </html>
... View more
11-17-2014
07:25 AM
|
0
|
2
|
1407
|
|
POST
|
When I search for an address, balloon appears to display that address. I would like the graphics to clear when I close the balloon. Below is the code with part of it commented out on how I thought I was supposed to do it. What do I need to change? <!DOCTYPE html> <html> <head> <title>Geocoder template</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } #search { display:block; position:absolute; z-index:3; top:20px; left:75px; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/dijit/Geocoder", "esri/graphic", "esri/symbols/SimpleMarkerSymbol", "esri/geometry/screenUtils", "esri/geometry/Extent", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "dojo/dom", "dojo/dom-construct", "dojo/on", "dojo/parser", "dojo/query", "dojo/_base/Color", "dojo/domReady!"], function (Map, Geocoder, Graphic, SimpleMarkerSymbol, screenUtils, Extent, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, dom, domConstruct, on, parser, query, Color ) { // declare initial map extent with spatial reference var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435} }); map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent }); // begin geocoder var geocoder = new Geocoder({ arcgisGeocoder:false, geocoders: [{ url:"http://maps.decaturil.gov/arcgis/rest/services/Public/WebAddressLocator/GeocodeServer", name: "Web Address Locator", placeholder: "Find address", outFields:"*" }], map:map, autoComplete:true, }, dom.byId("search")); geocoder.startup(); geocoder.on("select",showLocation); // dojo.disconnect(Geocoder,'onClear',function(){ // removeGraphics(); // }); // function removeGraphics() { // map.graphics.clear(); // } function showLocation(evt) { map.graphics.clear(); var point = evt.result.feature.geometry; var symbol = new SimpleMarkerSymbol() .setStyle("square") .setColor([255,0,0,0.5]); var graphic = new Graphic(point, symbol); map.graphics.add(graphic); map.infoWindow.setTitle("Search Result"); map.infoWindow.setContent(evt.result.name); map.infoWindow.show(evt.result.feature.geometry); } // end geocoder // add imagery var tiled = new ArcGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(operationalLayer); } ); </script> </head> <body class="soria"> <div id="search"></div> <div id="mapDiv"></div> </body> </html>
... View more
11-14-2014
02:40 PM
|
0
|
2
|
1368
|
|
POST
|
I am trying to change the background to the scalebar to white using CSS and it appears to have no affect? Any ideas? Here is my code: <!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } .esriScalebarRuler { background-color:White; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/dijit/Scalebar", "esri/geometry/Extent", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/ArcGISTiledMapServiceLayer", "dojo/dom", "dojo/on", "dojo/parser", "dojo/domReady!"], function (Map, Scalebar, Extent, ArcGISDynamicMapServiceLayer, ArcGISTiledMapServiceLayer, dom, on, parser ) { // declare initial map extent with spatial reference var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435} }); map = new Map("mapDiv", { showAttribution: false, sliderStyle: "small", extent: initialExtent }); // add imagery var tiled = new ArcGISTiledMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(operationalLayer); var scalebar = new Scalebar({ map: map, scalebarUnit: "dual" }); } ); </script> </head> <body class="soria"> <div id="mapDiv"></div> </body> </html>
... View more
11-14-2014
01:26 PM
|
0
|
5
|
2198
|
|
POST
|
I updated in my AMD code. It works! Thanks Dave. Here is my updated code for anyone that needs it: <!DOCTYPE html> <html> <head> <title>Decatur GIS Template</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } #HomeButton { position: absolute; top: 250px; left: 20px; z-index: 50; } #LocateButton { position: absolute; top: 300px; left: 20px; z-index: 50; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/config", "esri/dijit/HomeButton", "esri/dijit/LocateButton", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/tasks/GeometryService", "dojo/dom", "dojo/on", "dojo/parser", "esri/geometry/Extent", "dojo/domReady!"], function (Map, esriConfig, HomeButton, LocateButton, Tiled, ArcGISDynamicMapServiceLayer, GeometryService, dom, on, parser, Extent ) { // set custom extent var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435} }); map = new Map("mapDiv", { showAttribution: false, sliderStyle: "large", extent: initialExtent }); // add imagery var tiled = new Tiled("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // add operational layer var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); map.addLayer(operationalLayer); // declare geometry service esriConfig.defaults.geometryService = new GeometryService("http://maps.decaturil.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer"); // add home button to get full extent var home = new HomeButton({ map: map }, "HomeButton"); home.startup(); // add geolocate button to find the location of the current user geoLocate = new LocateButton({ map: map, highlightLocation: true }, "LocateButton"); geoLocate.startup(); } ); </script> </head> <body class="soria"> <div id="mapDiv"> <div id="HomeButton"></div> <div id="LocateButton"></div> </div> </body> </html>
... View more
11-12-2014
11:39 AM
|
0
|
0
|
891
|
|
POST
|
I am receiving the following error when I click on the LocateButton widget: Map: Geometry (wkid: 4326) cannot be converted to spatial reference of the map (wkid: 3435) The url for my application is at: Decatur GIS Template What do I need to change for the locate button to work? Here is my code: <!DOCTYPE html> <html> <head> <title>Decatur GIS Template</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } #HomeButton { position: absolute; top: 250px; left: 20px; z-index: 50; } #LocateButton { position: absolute; top: 300px; left: 20px; z-index: 50; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/dijit/HomeButton", "esri/dijit/LocateButton", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer", "dojo/dom", "dojo/on", "dojo/parser", "esri/geometry/Extent", "dojo/domReady!"], function (Map, HomeButton, LocateButton, Tiled, ArcGISDynamicMapServiceLayer, dom, on, parser, Extent ) { // set custom extent var initialExtent = new Extent({ "xmin": 777229.03, "ymin": 1133467.92, "xmax": 848340.14, "ymax": 1185634.58, "spatialReference": { "wkid": 3435}}); map = new Map("mapDiv", { showAttribution: false, sliderStyle: "large", extent:initialExtent }); // add imagery var tiled = new Tiled("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // add operational layer var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); map.addLayer(operationalLayer); // add home button to get full extent var home = new HomeButton({ map: map }, "HomeButton"); home.startup(); // add geolocate button to find the location of the current user geoLocate = new LocateButton({ map: map, highlightLocation:true }, "LocateButton"); geoLocate.startup(); } ); </script> </head> <body class="soria"> <div id="mapDiv"> <div id="HomeButton"></div> <div id="LocateButton"></div> </div> </body> </html>
... View more
11-12-2014
09:43 AM
|
0
|
2
|
2992
|
|
POST
|
Thanks Tim. I am new to AMD. Some of it is still guess work for me, but this gets me closer to my starting template.
... View more
11-07-2014
12:38 PM
|
0
|
1
|
750
|
|
POST
|
I modified my code based on an example to set the extent, but it appears not to be working. Here is my code: <!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer", "dojo/dom", "dojo/on", "dojo/parser", "esri/geometry/Extent", "dojo/domReady!"], function (Map, Tiled, ArcGISDynamicMapServiceLayer, dom, on, parser, Extent ) { map = new Map("mapDiv", { showAttribution: false, sliderStyle: "large" }); // add imagery var tiled = new Tiled("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); // set operational layers var baseLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Base/MapServer"); var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); // add operational layers map.addLayer(baseLayer); map.addLayer(operationalLayer); // set map extent var extent = new Extent(); extent.xmin = 777229.03; extent.ymin = 1133467.92; extent.xmax = 848340.14; extent.ymax = 1185634.58; map.setExtent(extent); } ); </script> </head> <body class="soria"> <div id="mapDiv"> </div> </body> </html>
... View more
11-07-2014
12:17 PM
|
0
|
3
|
2402
|
|
POST
|
Here is my code: <!DOCTYPE html> <html> <head> <title>Create a Map</title> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1, user-scalable=no"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://js.arcgis.com/3.11/esri/css/esri.css"> <style> html, body, #mapDiv { padding:0; margin:0; height:100%; } </style> <script src="http://js.arcgis.com/3.11/"></script> <script> var map; require(["esri/map", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer", "dojo/domReady!"], function (Map, Tiled, ArcGISDynamicMapServiceLayer ) { map = new Map("mapDiv", { showAttribution: false, sliderStyle: "large" }); var tiled = new Tiled("http://maps.decaturil.gov/arcgis/rest/services/Aerial_2014_Tiled/MapServer"); map.addLayer(tiled); var baseLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Base/MapServer"); var operationalLayer = new ArcGISDynamicMapServiceLayer("http://maps.decaturil.gov/arcgis/rest/services/Public/InternetVector/MapServer", { "opacity": 0.5 }); map.addLayer(baseLayer); map.addLayer(operationalLayer); } ); </script> </head> <body class="soria"> <div id="mapDiv"> <div id="extentDiv"> <textarea>Test</textarea> </div> </div> </body> </html>
... View more
11-07-2014
09:48 AM
|
0
|
2
|
1074
|
|
POST
|
I need a line measurement to match my buffer distance. The code modifications should related to this article: Measuring distances and areas when your map uses the Mercator projection | ArcGIS Blog Currently I have a buffer that uses a WKID of 4326 which appears to draw correctly with a measured buffer of 500 feet. The rest of the application uses a WKID 102100 which allows the application to display correctly, but the line tool is coming up with a measurement of about 150 feet more than the buffer. I have changed each 102100 one at a time even ones I did not think I should as I need this app to work in testing. Any idea where I am going wrong with my code so that my measurements work? Here is my code: /// <reference path="scriptaculous.js" /> /// <reference path="dragdrop.js" /> /// <reference path="effects.js" /> /// <reference path="rico.js" /> /// <reference path="ricoStyles.js" /> /// <reference path="ricoCommon.js" /> /// <reference path="ricoEffects.js" /> // Using Intellisense For The Above // http: //msdn.microsoft.com/en-us/library/bb385682.aspx ////////// AUTHOR & APPLICATION INFORMATION //////////////////////////////////////// // // Author: Chris Sergent // Date: May 1, 2012 // Application: SOA // //////////////////////////////////////////////////////////////////////////////////// // Address Points - Layer 0 // Bike Paths - Red Line - Layer 1 // Inhome Daycares - Dark Blue - Layer 2 // Daycare Facilities - Light Blue - Layer 3 // Playgrounds - Purple - Layer 4 // School Property - Green - Layer 5 // Macon Co. Tax Parcels - Layer 6 // Decatur Corporate Boundary - Layer 7 //////////////////////////////////////////////////////////////////////////////////// // // DECLARE AND SET VARIABLES BEGIN // //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // // SET UP DOJO BEGIN // //////////////////////////////////////////////////////////////////////////////////// /* Dojo Framework Require Begin */ dojo.require("dojo.parser"); dojo.require("dojo.number"); /* Parsing dojo.number include four functions - dojo.number.format() - formats numeric values - dojo.number.parse() - converts a string to a number - dojo.number.regexp() - returns a regular expression - dojo.number.round() - rounds numbers */ dojo.require("dojo.data.ItemFileReadStore"); dojo.require("dojo.fx"); dojo.require("dijit.dijit"); dojo.require("dijit.form.Button"); dojo.require("dijit.Toolbar"); dojo.require("dijit.TitlePane"); dojo.require("dijit.layout.BorderContainer"); dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.Editor"); dojo.require("dijit.layout.TabContainer"); dojo.require("dojox.grid.DataGrid"); // Declare Rounding Corners With Rico var roundCorners = Rico.Corner.round.bind(Rico.Corner); /* Dojo Framework Require End */ //----------------------------------------------------------- // REST API - Making Tools Available //----------------------------------------------------------- // ESRI dojo objects // allows you to work with the dynamic map service resource exposed by the ArcGIS REST API. // Reference: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/arcgisdynamicmapservicelayer.htm# dojo.require("esri.layers.agsdynamic"); // dynamic map services generate images on the fly. dojo.require("esri.layers.agstiled"); // cached map service. // esri.Map class created a container and required DOM structure for adding // -layers, graphics, info_window, and other navigation controls dojo.require("esri.map"); dojo.require("esri.toolbars.navigation"); dojo.require("esri.toolbars.draw"); // ESRI dojo tasks // esri.tasks.geometry class represents a geometry service exposed by the ArcGIS REST API. // Operations include - project, simplify, buffer, and relationships // Reference: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/geometry.htm# dojo.require("esri.tasks.geometry"); // Represents a geocode service resource exposed by the ArcGIS REST API. // It is used to generate candidates for an address. // It is also used to find an address for a given location. // Reference: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/locator.htm# dojo.require("esri.tasks.locator"); // ESRI dojo task for querying against the ArcGIS REST API. // Reference: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/querytask.htm# dojo.require("esri.tasks.query"); // ESRI dojo task for identifying against the ArcGIS REST API. dojo.require("esri.tasks.identify"); // ESRI dojo graphics utility for displaying features in a single layer using the ArcGIS REST API. // Reference:http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/featurelayer.htm# dojo.require("esri.layers.FeatureLayer"); /* ESRI Dojo Objects End */ //////////////////////////////////////////////////////////////////////////////////// // // SET UP DOJO END // //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // // DECLARE AND SET VARIABLES END // //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // // MAP EXTENTS // //////////////////////////////////////////////////////////////////////////////////// /* Set the extent of one map service. For multiple map services, see the section titled Setting the beginning extent when using multiple services at- http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/arcgis/help/jshelp_start.htm */ ////WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING///////// // // WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING // // ENSURE YOU HAVE A GEOMETRY SERVICE CREATED AND RUNNING ON // ESRI ArcGIS Server OR YOUR MAP MAY NOT DISPLAY // // // NOTE: You do not necessarily need to reference the geometry service // in your code. // ////WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING///////// // Extent and Spatial reference of our map service //var startExtent = new esri.geometry.Extent({ "xmin": 778733.96207758, "ymin": 1133387.86320644, "xmax": 849794.792685476, "ymax": 1193607.08672764, "spatialReference": { "wkid": 102100} }); // This is the required projection to display in Decatur for imagery var startExtent = new esri.geometry.Extent({ "xmin": -9907408.2369, "ymin": 4839236.5572, "xmax": -9897146.5658, "ymax": 4847826.1683, "spatialReference": { "wkid": 102100} }); // Sets the extent for the find address query var addressExtent, newExtent; //----------------------------------------------------------- // Map Services Begin //----------------------------------------------------------- // Define Map Section var gisUrl; // GIS Server Location // Old Url - http://64.107.106.57/ gisUrl = "http://decgis01/"; var rasSvc; // Raster Service rasSvc = "Public/Aerial_2012/MapServer"; var mapSvc; // Map Service mapSvc = "Internal/SOA/MapServer"; var addrLocSvc; // Address Locator Service addrLocSvc = "Public/WebAddressLocator/GeocodeServer"; var geomSvc; // Geometry Service geomSvc = "Utilities/Geometry/GeometryServer"; var map, dynamicMapServiceLayer, imageDynamicMapServiceLayer; dynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer(gisUrl + "arcgis/rest/services/" + mapSvc); dynamicMapServiceLayer.setOpacity(0.4); //imageDynamicMapServiceLayer = new esri.layers.ArcGISDynamicMapServiceLayer(gisUrl + "arcgis/rest/services/" + rasSvc); imageDynamicMapServiceLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer"); // http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/arcgisdynamicmapservicelayer.htm#setImageFormat //imageDynamicMapServiceLayer.setImageFormat("jpg"); // Navigation Tools var navToolbar; // Locator service to be used for find address var locator; locator = new esri.tasks.Locator(gisUrl + "arcgis/rest/services/" + addrLocSvc); // SR required for Decatur var spatialReference = new esri.SpatialReference({ wkid: 102100 }); locator.setOutSpatialReference(spatialReference); // Geometry Service var geometryService; geometryService = new esri.tasks.GeometryService(gisUrl + "arcgis/rest/services/" + geomSvc); //----------------------------------------------------------- // Map Services End //----------------------------------------------------------- //----------------------------------------------------------- // ESRI Tasks Begin //----------------------------------------------------------- // Define Macon County Tax Parcels as Layer to Query // http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_querytask.htm# var queryTask = new esri.tasks.QueryTask(gisUrl + "arcgis/rest/services/" + mapSvc + "/6"); // Creates a new query to be used against the current geometry var queryParams = new esri.tasks.Query(); var circleSymbol = new esri.symbol.SimpleMarkerSymbol(); circleSymbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE); circleSymbol.setColor(new dojo.Color([153, 0, 51, 0.75])); // Declare coordinate for drawing point in find address var x1, y1; // Declare geometry for find address var geom; // Identify Task var identifyHandle; var identifyTask, identifyParams; // Measure Polyline var measureLine; var lineLengthParams = new esri.tasks.LengthsParameters(); var measureLineGraphic; // Measure Polygon var measurePolygon; var polygonLengthParams = new esri.tasks.AreasAndLengthsParameters(); var measurePolygonGraphic; // Project Point var pt = null; var point; var ptSymbol; var ptGraphic; var ptOutSR; var pointHandle; var inTown; //----------------------------------------------------------- // ESRI Tasks End //----------------------------------------------------------- //----------------------------------------------------------- // Query Layers Begin //----------------------------------------------------------- // Layers to evaluate if they are in a safe zone based on a sex offender's potential address var qryBikePaths = new esri.tasks.QueryTask(gisUrl + "arcgis/rest/services/" + mapSvc + "/1") var qryHomeDayCare = new esri.tasks.QueryTask(gisUrl + "arcgis/rest/services/" + mapSvc + "/2"); var qryDayCare = new esri.tasks.QueryTask(gisUrl + "arcgis/rest/services/" + mapSvc + "/3"); var qryParks = new esri.tasks.QueryTask(gisUrl + "arcgis/rest/services/" + mapSvc + "/4"); var qrySchools = new esri.tasks.QueryTask(gisUrl + "arcgis/rest/services/" + mapSvc + "/5"); var qryDecaturBoundary = new esri.tasks.QueryTask(gisUrl + "arcgis/rest/services/" + mapSvc + "/7"); //----------------------------------------------------------- // Query Layers End //----------------------------------------------------------- //----------------------------------------------------------- // Graphics Definition Begin //----------------------------------------------------------- /* Define initial address point to be drawn for find address */ var firstGraphic; /* Define queried point to be drawn for find address */ var graphicPt; /* Defines the line drawn for the polygon of the parcel */ var selectParcel; //----------------------------------------------------------- // Graphics Definition End //----------------------------------------------------------- //////////////////////////////////////////////////////////////////////////////////// // // PAGE INITIALIZATION // //////////////////////////////////////////////////////////////////////////////////// function init() { // Initialize JavaScript Framework Controls // Round Sidebar Corners roundSidebarCorners(); // Add Sidebar addSideBar(); // Add Sidebar Title addSideBarTitle(); // Add Map Navigation Title addMapNavigationTitle(); // Add Map Navigation Content addMapNavigationContent(); // Add Map Tools Title addMapToolsTitle(); // Add Map Tools Content addMapToolsContent(); // Add Address Search Title addAddressQueryTitle(); // Add Address Search Content addAddressQueryContent(); $("sideBarTop").style.cursor = "hand"; // Sidebar Top - To Drag the Sidebar $("sideBarTopFill").style.cursor = "hand"; // Sidebar Top Fill - To Drag the Sidebar $("sideBarBottom").style.cursor = "hand"; // Sidebar Bottom - To Drag the Sidebar $("sideBarBottomFill").style.cursor = "hand"; // Sidebar Bottom Fill - To Drag the Sidebar $("dojoGrid").style.display = 'none'; $("btnClearGraphics").style.display = 'none'; // Add Footer Section addFooterSection(); addFooter(); // Enable Sidebar Drag EnableDrag(); // Set Browser to Full Size maxBrowserWindow(); /* The proxy section is defined on the ESRI sample. I have included it as part of the documentation reads that the measuring will not work. I thought that might be important. */ // Proxy Definition Begin //identify proxy page to use if the toJson payload to the geometry service is greater than 2000 characters. //If this null or not available the project and lengths operation will not work. Otherwise it will do a http post to the proxy. esriConfig.defaults.io.proxyUrl = "proxy.ashx"; esriConfig.defaults.io.alwaysUseProxy = false; // Proxy Definition End // Programmatically define web services // Add controls to the interface esriConfig.defaults.map.sliderLabel = null; //////////////////////////////////////////////////////////////////////////////////// // // Note: // The last layer added to the map is the top layer. // Setting the opacity as shown below allows for hidden // layers to become visible. // //////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////// // // LAYERS // //////////////////////////////////////////////////////////////////////////////////// /* Add a dynamic layer */ /* All map services use a unique reference to identify the map service In ESRI ArcGIS Server, the unique reference is the URL of the published map service */ map = new esri.Map("mapSection", { extent: startExtent }); // Enable identify dojo.connect(map, "onLoad", initFunctionality); // The dynamic layer is added to the map map.addLayer(imageDynamicMapServiceLayer); map.addLayer(dynamicMapServiceLayer); //alert(dynamicMapServiceLayer.layerInfos[5].name); //alert((dynamicMapServiceLayer.visibleLayers.length) + 1); // Add toolbar navToolbar = new esri.toolbars.Navigation(map); // Sets the navigation bar up to handle previous and next extent dojo.connect(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler); // Reference - http://forums.arcgis.com/threads/48318-Set-zoomToFullExtent-to-be-my-Initial-Extent navToolbar.zoomToFullExtent = function () { map.setExtent(startExtent); } // Add Polygon Tool measurePolygon = new esri.toolbars.Draw(map); dojo.connect(measurePolygon, "onDrawEnd", function (geometry) { removePolygon(); deactivatePoint(); // This line of code is a guess polygonLengthParams.polygons = [geometry]; polygonLengthParams.areaUnit = esri.tasks.GeometryService.UNIT_SQUARE_FEET; polygonLengthParams.areaUnit = esri.tasks.GeometryService.UNIT_ACRES; geometryService.simplify([geometry], function (simplifiedGeometries) { polygonLengthParams.polygons = simplifiedGeometries; geometryService.areasAndLengths(polygonLengthParams); }); geometryService.lengths(polygonLengthParams); measurePolygonGraphic = map.graphics.add(new esri.Graphic(geometry, new esri.symbol.SimpleFillSymbol())); }); // Add Line Tool measureLine = new esri.toolbars.Draw(map); dojo.connect(measureLine, "onDrawEnd", function (geometry) { deactivatePoint(); removePolygon(); lineLengthParams.polylines = [geometry]; lineLengthParams.lengthUnit = esri.tasks.GeometryService.UNIT_FOOT; lineLengthParams.geodisc = true; geometryService.lengths(lineLengthParams); measureLineGraphic = map.graphics.add(new esri.Graphic(geometry, new esri.symbol.SimpleLineSymbol())); }); // Diplay Polygon Area and Distance after measuring dojo.connect(geometryService, "onAreasAndLengthsComplete", outputAreaAndLength); // Display Line Distance after measuring dojo.connect(geometryService, "onLengthsComplete", outputDistance); // Make Address Locator Available dojo.connect(locator, "onAddressToLocationsComplete", showResults); // Connect the row click item to the dojo grid dojo.connect(dojoGrid, "onRowClick", onRowClickHandler); // Enable tab display for identify dojo.connect(map.infoWindow, "onShow", function () { dijit.byId("tabs").resize(); }); } /* Map Tools Begin */ // Add history reference for previous and next extent on map toolbar function extentHistoryChangeHandler() { $("btnPrevExtent").disabled = navToolbar.isFirstExtent(); $("btnNextExtent").disabled = navToolbar.isLastExtent(); } /* Find Address Point Function Begins */ function findAddress() { if (Page_IsValid) { // Clear the map map.graphics.clear(); $("lblResponse").innerHTML = ""; $("lblAddressStatus").innerHTML = ""; var add = dojo.byId("txtAddress").value.split(","); var address = { SingleKey: add[0] }; /* Locator begins searching for address matches when the method addressToLocations is called. The event listener onAddressToLocationsComplete calls the function showResults() onAddressToLocationsComplete fires when Locator.addressToLocation() has completed */ locator.addressToLocations(address); } } function showResults(candidates) { var candidate; var symbol = new esri.symbol.SimpleMarkerSymbol(); var infoTemplate = new esri.InfoTemplate("Location", "Address: ${address}<br />Score: ${score}"); symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE); symbol.setColor(new dojo.Color([255, 0, 0, 0.75])); var points = new esri.geometry.Multipoint(map.spatialReference); var incrementor = 0; var validRecords = 0; var xLoc, yLoc, singleAddress; $("dojoGrid").style.display = 'inherit'; var items = [], obj = {}, loc; dojo.forEach(candidates, function (candidate) { if (candidate.score > 50) { obj = {}; obj['address'] = candidate.address; obj['score'] = candidate.score; loc = candidate.location; obj['x'] = loc.x; obj['y'] = loc.y; obj['location'] = loc.x + ', ' + loc.y; items.push(obj); } } ); console.log(items); // Create data object to be used in store var data = { items: items }; // Create data store and bind to grid store = new dojo.data.ItemFileReadStore({ data: data }); var grid = new dojox.grid.DataGrid; grid = dijit.byId('dojoGrid'); grid.setStore(store); // Evaluate number of addresses returned // if there is only one address, set the height of the grid to 0 if (items.length == 1) { $("dojoGrid").style.height = 0 } else { // if there is more than one address set the height 50x the number of items addresses returned $("dojoGrid").style.height = 50 * items.length; } // Evaluate if any candidates exist if (candidates.length == 0) { $("lblAddressStatus").innerHTML = "The Address you entered is not recognized. Make sure you entered it correctly."; $("lblAddressStatus").className = "warningMessage"; $("lblResponse").innerHTML = " Your address should be like the example:" + "<br> 111 E MAIN ST " + "<br> And the format should be:" + "<br> Street Address"; $("lblResponse").className = "warningMessage"; $("lblBikePath").innerHTML = ""; $("lblHomeDayCare").innerHTML = ""; $("lblDayCare").innerHTML = ""; $("lblParks").innerHTML = ""; $("lblSchools").innerHTML = ""; $("lblCityLimits").innerHTML = ""; $("btnClearGraphics").style.display = 'none'; $("dojoGrid").style.display = 'none'; navToolbar.zoomToFullExtent(); // exit code return; } else { // Check all candidates for a matching score greater than 50 for (incrementor; incrementor < candidates.length; incrementor++) { candidate = candidates[incrementor]; if (candidate.score > 50) { var attributes = { address: candidates[incrementor].address, score: candidates[incrementor].score }; var graphic = new esri.Graphic(candidates[incrementor].location, symbol, attributes, infoTemplate); map.graphics.add(graphic); map.graphics.add(new esri.Graphic(candidate.location, new esri.symbol.TextSymbol(attributes.address).setOffset(0, 8))); points.addPoint(candidate.location); validRecords = incrementor + 1; xLoc = candidates[incrementor].location.x; yLoc = candidates[incrementor].location.y; singleAddress = candidates[incrementor].address; } } if (validRecords > 1) { $("lblAddressStatus").innerHTML = "Success!"; $("lblAddressStatus").className = "normalMessage"; map.setExtent(points.getExtent().expand(3)); $("btnClearGraphics").style.display = 'inherit'; } else if (validRecords == 0) { $("lblAddressStatus").innerHTML = "The Address you entered is not recognized. Make sure you entered it correctly."; $("lblAddressStatus").className = "warningMessage"; $("lblResponse").innerHTML = " Your address should be like the example:" + "<br> 111 E MAIN ST " + "<br> And the format should be:" + "<br> Street Address"; $("lblResponse").className = "warningMessage"; $("lblBikePath").innerHTML = ""; $("lblHomeDayCare").innerHTML = ""; $("lblDayCare").innerHTML = ""; $("lblParks").innerHTML = ""; $("lblSchools").innerHTML = ""; $("lblCityLimits").innerHTML = ""; $("btnClearGraphics").style.display = 'none'; $("dojoGrid").style.display = 'none'; navToolbar.zoomToFullExtent(); } else if (validRecords == 1) { // Coordinates of single address returned $("lblAddressStatus").innerHTML = "The Address " + singleAddress + " was found."; $("lblAddressStatus").className = "normalMessage"; map.setExtent(points.getExtent()); $("btnClearGraphics").style.display = 'inherit'; map.graphics.clear(); $("lblResponse").innerHTML = ""; x1 = xLoc; y1 = yLoc; geom = new esri.geometry.Point(x1, y1, new esri.SpatialReference({ wkid: 343 })); graphicPt = new esri.Graphic(geom, symbol); // Add Point map.graphics.add(graphicPt); // Initialize Query // http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_querytask.htm# var qry = new esri.tasks.Query(); qry.returnGeometry = true; qry.ourSpatialReference = { "wkid": 102100 }; qry.geometry = geom; // Check if point is in city limits qry.spatialRelationship = esri.tasks.Query.SPATIAL_INTERSECTS; qryDecaturBoundary.execute(qry, qryDecaturBoundary_complete); } } } /* Display Grid Cell That Was Clicked */ function onRowClickHandler(evt) { map.graphics.clear(); $("lblAddressStatus").innerHTML = ""; $("lblResponse").innerHTML = ""; // Set X and Y Coordinates x1 = dojoGrid.getItem(evt.rowIndex).x; y1 = dojoGrid.getItem(evt.rowIndex).y; // Declare geometry and assign coordinates // http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/point.htm# // http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/point.htm#PointConst1 // Required for Decatur geom = new esri.geometry.Point(x1[0], y1[0], new esri.SpatialReference({ wkid: 102100 })); graphicPt = new esri.Graphic(geom, circleSymbol); // Add Point map.graphics.add(graphicPt); // Initialize Query // http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_querytask.htm# var qry = new esri.tasks.Query(); qry.returnGeometry = true; qry.ourSpatialReference = { "wkid": 102100 }; qry.geometry = geom; // Check if point is in city limits qry.spatialRelationship = esri.tasks.Query.SPATIAL_INTERSECTS; qryDecaturBoundary.execute(qry, qryDecaturBoundary_complete); } // Custom Buffer Sample // http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/util_buffergraphic.html# // http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/exp_cors_buffer.html function doBuffer(geometry) { // Set up buffer parameters var params = new esri.tasks.BufferParameters(); params.distances = [500]; params.bufferSpatialReference = new esri.SpatialReference({ wkid: 3435 }); params.outSpatialReference = map.spatialReference; params.unit = esri.tasks.GeometryService.UNIT_FOOT; geometryService.simplify([geometry], function (geometries) { params.geometries = geometries; geometryService.buffer(params, showBuffer); }); } function showBuffer(bufferedGeometries) { map.graphics.clear(); var symbol = new esri.symbol.SimpleFillSymbol( esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol( esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0, 0.65]), 2 ), new dojo.Color([255, 0, 0, 0.35]) ); var graphic; dojo.forEach(bufferedGeometries, function (geometry) { graphic = new esri.Graphic(geometry, symbol, { buffer: true }); // Add point map.graphics.add(graphicPt); // Add polygon map.graphics.add(firstGraphic); // Add Buffer map.graphics.add(graphic); }); map.setExtent(bufferedGeometries[0].getExtent().expand(2)); // evaluate if buffered geometries intersect with safe zones queryParams.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS; queryParams.returnGeometry = true; queryParams.geometry = graphic.geometry; // Evaluate if buffer intersects with bikepaths qryBikePaths.execute(queryParams, qryBikePaths_complete); // Evaluate if buffer intersects with a daycare qryDayCare.execute(queryParams, qryDayCare_complete); // Evaluate if buffer intersects with playground equipment qryParks.execute(queryParams, qryParks_complete); // Evaluate if buffer intersects with a Home Daycare qryHomeDayCare.execute(queryParams, qryHomeDayCare_complete); // Evaluate if buffer intersects with a school qrySchools.execute(queryParams, qrySchools_complete); } // Evaluate if address is in City Limits function qryDecaturBoundary_complete(featureSets) { if (featureSets.features.length > 0) { $("lblResponse").innerHTML = ""; // Initialize Query // http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_querytask.htm# var query = new esri.tasks.Query(); query.returnGeometry = true; // This SR is requirer to draw the parcel polygon query.outSpatialReference = { "wkid": 102100 }; query.geometry = geom; // Checks where point intersects with parcel query.spatialRelationship = esri.tasks.Query.SPATIAL_REL_INTERSECTS; queryTask.execute(query); // Declare the graphic for the polygon firstGraphic = null; selectParcel = null; // +++++Listen for QueryTask onComplete event+++++ dojo.connect(queryTask, "onComplete", function (graphics) { firstGraphic = graphics.features[0]; selectParcel = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new dojo.Color([98, 194, 204]), 3), new dojo.Color([255, 0, 0, 0])); firstGraphic.setSymbol(selectParcel); // Add Polygon Graphic On parcel as Selection map.graphics.add(firstGraphic); geometry = graphics.features[0].geometry; // Buffer polygon doBuffer(geometry); }); } else { $("lblResponse").innerHTML = "It's outside the city."; } return inTown; } // Evaluate Safe Zones function qryBikePaths_complete(featureSet) { if (featureSet.features.length > 0) { $("lblBikePath").innerHTML = "Caution, Bikepath"; $("lblBikePath").className = "cautionMessage"; } else { $("lblBikePath").innerHTML = "Bikepath Safe"; $("lblBikePath").className = "successMessage"; } } function qryHomeDayCare_complete(featureSet) { if (featureSet.features.length > 0) { $("lblHomeDayCare").innerHTML = "Home Daycare Unsafe"; $("lblHomeDayCare").className = "warningMessage"; } else { $("lblHomeDayCare").innerHTML = "Home Daycare Safe"; $("lblHomeDayCare").className = "successMessage"; } } function qryDayCare_complete(featureSet) { if (featureSet.features.length > 0) { $("lblDayCare").innerHTML = "Daycare Unsafe"; $("lblDayCare").className = "warningMessage"; } else { $("lblDayCare").innerHTML = "Daycare Safe"; $("lblDayCare").className = "successMessage"; } } function qryParks_complete(featureSet) { if (featureSet.features.length > 0) { $("lblParks").innerHTML = "Parks Unsafe"; $("lblParks").className = "warningMessage"; } else { $("lblParks").innerHTML = "Parks Safe"; $("lblParks").className = "successMessage"; } } function qrySchools_complete(featureSet) { if (featureSet.features.length > 0) { $("lblSchools").innerHTML = "Schools Unsafe"; $("lblSchools").className = "warningMessage"; } else { $("lblSchools").innerHTML = "Schools Safe"; $("lblSchools").className = "successMessage"; } } function clearResults() { $("btnClearGraphics").style.display = 'none'; $("dojoGrid").style.display = 'none'; $("lblResponse").innerHTML = ""; $("lblAddressStatus").innerHTML = ""; $("lblBikePath").innerHTML = ""; $("lblHomeDayCare").innerHTML = ""; $("lblParks").innerHTML = ""; $("lblDayCare").innerHTML = ""; $("lblSchools").innerHTML = ""; $("lblCityLimits").innerHTML = ""; $("txtAddress").value = "111 MAIN ST"; map.graphics.clear(); navToolbar.zoomToFullExtent(); } function initFunctionality(map) { identifyTask = new esri.tasks.IdentifyTask(gisUrl + "arcgis/rest/services/" + mapSvc); identifyParams = new esri.tasks.IdentifyParameters(); identifyParams.tolerance = 3; identifyParams.returnGeometry = true; identifyParams.layerIds = [0, 1, 2, 3, 4, 5, 6]; identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_ALL; identifyParams.width = map.width; identifyParams.height = map.height; map.infoWindow.resize(415, 200); map.infoWindow.setContent(dijit.byId("tabs").domNode); map.infoWindow.setTitle("Identify Results"); } function doIdentify(evt) { identifyParams.geometry = evt.mapPoint; identifyParams.mapExtent = map.extent; identifyTask.execute(identifyParams, function (idResults) { addToMap(idResults, evt); }); } function addToMap(idResults, evt) { addressResults = { displayFieldName: null, features: [] }; // 0 inHomeDayCareResults = { displayFieldName: null, features: [] }; //2 dayCareFacilitiesResults = { displayFieldName: null, features: [] }; //3 playgroundResults = { displayFieldName: null, features: [] }; //4 schoolPropertyResults = { displayFieldName: null, features: [] }; //5 maconTaxParcelResults = { displayFieldName: null, features: [] }; // 6 // evaluate for layers 0,1, 3, 4, 5, and 6 for (var i = 0, il = idResults.length; i < il; i++) { var idResult = idResults; if (idResult.layerId === 0) { if (!addressResults.displayFieldName) { addressResults.displayFieldName = idResult.displayFieldName }; addressResults.features.push(idResult.feature); dijit.byId("safeZoneTab").setContent(layerTabContent(addressResults, "addressResults")); i = idResults.length + 1; } else if (idResult.layerId === 2) { if (!inHomeDayCareResults.displayFieldName) { inHomeDayCareResults.displayFieldName = idResult.displayFieldName }; inHomeDayCareResults.features.push(idResult.feature); dijit.byId("safeZoneTab").setContent(layerTabContent(inHomeDayCareResults, "inHomeDayCareResults")); i = idResults.length + 1; } else if (idResult.layerId === 3) { if (!dayCareFacilitiesResults.displayFieldName) { dayCareFacilitiesResults.displayFieldName = idResult.displayFieldName }; dayCareFacilitiesResults.features.push(idResult.feature); dijit.byId("safeZoneTab").setContent(layerTabContent(dayCareFacilitiesResults, "dayCareFacilitiesResults")); i = idResults.length + 1; } else if (idResult.layerId === 4) { if (!playgroundResults.displayFieldName) { playgroundResults.displayFieldName = idResult.displayFieldName }; playgroundResults.features.push(idResult.feature); dijit.byId("safeZoneTab").setContent(layerTabContent(playgroundResults, "playgroundResults")); i = idResults.length + 1; } else if (idResult.layerId === 5) { if (!schoolPropertyResults.displayFieldName) { schoolPropertyResults.displayFieldName = idResult.displayFieldName }; schoolPropertyResults.features.push(idResult.feature); dijit.byId("safeZoneTab").setContent(layerTabContent(schoolPropertyResults, "schoolPropertyResults")); i = idResults.length + 1; } else if (idResult.layerId === 6) { if (!maconTaxParcelResults.displayFieldName) { maconTaxParcelResults.displayFieldName = idResult.displayFieldName }; maconTaxParcelResults.features.push(idResult.feature); dijit.byId("safeZoneTab").setContent(layerTabContent(maconTaxParcelResults, "maconTaxParcelResults")); i = idResults.length + 1; } map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint)); } } function layerTabContent(layerResults, layerName) { var content = ""; switch (layerName) { case "addressResults": content = "<i>Total features returned: " + layerResults.features.length + "</i>"; content += "<table border='1'><tr><th>Address</th><th>PIN</th></tr>"; for (var i = 0, il = layerResults.features.length; i < il; i++) { content += "<tr><td>" + layerResults.features.attributes['ADDRESS'] + " </td>"; content += "<td>" + layerResults.features.attributes['PIN_NUM'] + "</td>"; } content += "</tr></table>"; break; case "inHomeDayCareResults": content = "<i>Total features returned: " + layerResults.features.length + "</i>"; content += "<table border='1'><tr><th>Description</th><th>Address</th></tr>"; for (var i = 0, il = layerResults.features.length; i < il; i++) { content += "<tr><td>" + layerResults.features.attributes['USAGE_DESC'] + " </td>"; content += "<td>" + layerResults.features.attributes['ADDRESS'] + "</td>"; } content += "</tr></table>"; break; case "dayCareFacilitiesResults": content = "<i>Total features returned: " + layerResults.features.length + "</i>"; content += "<table border='1'><tr><th>Description</th><th>Name</th></tr>"; for (var i = 0, il = layerResults.features.length; i < il; i++) { content += "<tr><td>Daycare Facilities</td>"; content += "<td>" + layerResults.features.attributes['SCHOOL_NAM'] + "</td>"; } content += "</tr></table>"; break; case "playgroundResults": content = "<i>Total features returned: " + layerResults.features.length + "</i>"; content += "<table border='1'><tr><th>Description</th><th>Name</th></tr>"; for (var i = 0, il = layerResults.features.length; i < il; i++) { content += "<tr><td>Playgrounds</td>"; content += "<td>" + layerResults.features.attributes['PARKNAME'] + " </td>"; } content += "</tr></table>"; break; case "schoolPropertyResults": content = "<i>Total features returned: " + layerResults.features.length + "</i>"; content += "<table border='1'><tr><th>Description</th><th>Name</th></tr>"; for (var i = 0, il = layerResults.features.length; i < il; i++) { content += "<tr><td>School Property</td>"; content += "<td>" + layerResults.features.attributes['SCHOOL_NAM'] + "</td>"; } content += "</tr></table>"; break; case "maconTaxParcelResults": content = "<i>Total features returned: " + layerResults.features.length + "</i>"; content += "<table border='1'><tr><th>Name</th><th>Address</th></tr>"; for (var i = 0, il = layerResults.features.length; i < il; i++) { content += "<tr><td>" + layerResults.features.attributes['PRIMARYNAME'] + " </td>"; content += "<td>" + layerResults.features.attributes['SITEADDRESS'] + " </td>"; } content += "</tr></table"; break; } return content; } function runIdentify() { measureLine.deactivate(); removePolygon(); removePolyline(); measurePolygon.deactivate(); identifyHandle = dojo.connect(map, "onClick", doIdentify); identifyHandle; } function outputDistance(result) { dojo.byId("lblDistance").innerHTML = " " + dojo.number.format(result.lengths[0]) + " feet"; measureLine.deactivate(); } function outputAreaAndLength(result) { console.log(dojo.toJson(result)); dojo.byId("lblDistance").innerHTML = " " + dojo.number.format(result.areas[0]) + " sq. feet"; measurePolygon.deactivate(); } function removePolyline() { // Remove line graphics map.graphics.remove(measureLineGraphic); // Deactivate measure line measureLine.deactivate(); // Remove point map.graphics.remove(ptGraphic); // Deactivate pointhttp://maps.decaturil.gov/ArcGIS/rest/services/InternalMapSampleServiceTest/MapServer/2 or the current URL dojo.disconnect(pointHandle); } function removeMeasureTools() { // Remove line graphics map.graphics.remove(measureLineGraphic); // Deactivate measure line measureLine.deactivate(); // Remove point map.graphics.remove(ptGraphic); // Deactivate point dojo.disconnect(pointHandle); // Remove polygon map.graphics.remove(measurePolygonGraphic); // Deactivate polygon measurePolygon.deactivate(); } // Deactivates Navtoolbar and Identify function deactivateNavToolbar() { // Deactivate Toolbar navToolbar.deactivate(); // Deactivate Identify dojo.disconnect(identifyHandle); } // Deactivates Identify function deactivateIdentify() { // Disables identify dojo.disconnect(identifyHandle); } function projectPoint() { // Remove the line graphics map.graphics.remove(measureLineGraphic); // Deactivate measure line measureLine.deactivate(); // Remove polygon graphics map.graphics.remove(measurePolygonGraphic); // Deactivate polygon measurePolygon.deactivate(); // Deactivate the nav toolbar navToolbar.deactivate(); // Deactivate identify deactivateIdentify(); // Wire up the point handle to run the projectToWebMercator pointHandle = dojo.connect(map, "onClick", projectToWebMercator); pointHandle; } function projectToWebMercator(evt) { map.graphics.remove(ptGraphic); point = evt.mapPoint; ptSymbol = new esri.symbol.SimpleMarkerSymbol().setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE); ptGraphic = new esri.Graphic(point, ptSymbol); ptOutSR = new esri.SpatialReference({ wkid: 102100 }); map.graphics.add(ptGraphic); geometryService.project([point], ptOutSR, function (projectedPoints) { point = projectedPoints[0]; dojo.byId("lblDistance").innerHTML = " x:" + dojo.number.format(point.x) + ", y:" + dojo.number.format(point.y); }); // Disconnect point handle dojo.disconnect(pointHandle); } function clearPointAndPolygon() { removePoint(); removePolygon(); } function clearPointAndLine() { removePoint(); removePolyline(); } function removePoint() { map.graphics.remove(ptGraphic); } function removePolygon() { map.graphics.remove(measurePolygonGraphic); } function removePolyline() { map.graphics.remove(measureLineGraphic); } function deactivatePoint() { map.graphics.remove(ptGraphic); dojo.disconnect(pointHandle); } function printMap() { alert("Print Map"); } function getHelp() { alert("Help Me"); } /* Map Tools End */ // Rico Functions // Round Sidebar Corners function roundSidebarCorners() { roundCorners('sideBarTop', { corners: "top", color: "#E1EBFB" }); roundCorners('sideBarBottom', { corners: "bottom", color: "#E1EBFB" }); } // Dojo Function // Add Sidebar function addSideBar() { var sideBarConfig = new dijit.layout.BorderContainer({ }, $("sideBar") ); } // Add Sidebar Title function addSideBarTitle() { var sideBarTitleConfig = new dijit.TitlePane({ title: "SOA Tools" }, $("sideBarTitle") ); } // Add Map Navigation title function addMapNavigationTitle() { var mapNavigationTitleConfig = new dijit.TitlePane({ title: "Navigation", open: true }, $("mapNavigationTitle") ); } // Add Map Navigation Content function addMapNavigationContent() { var mapNavigationContentConfig = new dijit.layout.ContentPane({ }, $("mapNavigationContent") ); } // Add Map Tools Title function addMapToolsTitle() { var mapToolsTitleConfig = new dijit.TitlePane({ title: "Map Tools", open: false }, $("mapToolsTitle") ); } // Add Map Tools Content function addMapToolsContent() { var mapToolsContentConfig = new dijit.layout.ContentPane({ }, $("mapToolsContent") ); } // Add Address Query Title function addAddressQueryTitle() { var addressQueryTitleConfig = new dijit.TitlePane({ title: "Address Search", open: true }, $("queryAddressTitle") ); } // Add Query Address Content function addAddressQueryContent() { var addressQueryContentConfig = new dijit.layout.ContentPane({ }, $("queryAddress") ); } // Add Footer Section function addFooterSection() { var footerSection = new dijit.TitlePane({ title: "Ask For Assistance", open: false }, $("footerTitle") ); } // Add Footer function addFooter() { var pageFooter = new dijit.layout.ContentPane({ }, $("footer") ); } // Scriptaculous Functions // Enable Sidebar Drag function EnableDrag() { new Draggable($("sideBar")); } //Maximize Browser Window Begin // Reference - http://www.javascriptfreecode.com/53.htm function maxBrowserWindow() { top.window.moveTo(0, 0); if (document.all) { top.window.resizeTo(screen.availWidth, screen.availHeight); } else if (document.layers || document.getElementById) { if (top.window.outerHeight < screen.availHeight || top.window.outerWidth < screen.availWidth) { top.window.outerHeight = screen.availHeight; top.window.outerWidth = screen.availWidth; } } } // Maximize Browser Window End // Initialize Page dojo.addOnLoad(init);@
... View more
09-11-2014
01:54 PM
|
0
|
1
|
1347
|
|
POST
|
Yes, you can. ArcGIS Online is built on the JavaScript API.
... View more
08-15-2014
09:16 AM
|
0
|
1
|
1579
|
|
POST
|
Rookie mistake. I didn't clear my cache. It's working now. Thanks for the help.
... View more
08-14-2014
09:48 AM
|
0
|
0
|
772
|
|
POST
|
That line wasn’t in the main.js file but I performed a search and changed it in the file named CreateGeocoder.js and the autoComplete is still not working. I uploaded the project to dropbox at this location if that helps: https://dl.dropboxusercontent.com/u/30750655/ago_atlas.zip
... View more
08-13-2014
07:32 AM
|
0
|
2
|
772
|
|
POST
|
Kelly, That works, but the autocomplete does not. I thought I would need to add a block for a new Geocoder, but that does not seem to be working. Here is my modified commonConfig.js file. Do you know what I need to do? define( [], function() { var config = { bingMapsKey:"", units: null, helperServices: { geometry:{ url: location.protocol + "//maps.decaturil.gov/arcgis/rest/services/Utilities/Geometry/GeometryServer" }, printTask: , elevationSync:, geocode: [] }, queryForOrg: false }; // could use a has() test to optionally populate some global // property so that the stuff defined is in some global identifier // // instead, just populate a global, will need to remove the next line when // when we remove support for loading modules with dojo.require // which will be when we move to Dojo 2.0 commonConfig = config; // instead of using a global, this should probably be added to some namespace... // do the templates have a common namespace that they use? return config; });
... View more
08-12-2014
02:51 PM
|
0
|
4
|
1814
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-26-2015 12:31 PM | |
| 1 | 06-24-2015 06:06 AM | |
| 1 | 07-15-2015 12:34 PM | |
| 1 | 05-21-2015 02:27 PM | |
| 1 | 05-19-2015 11:52 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|