|
POST
|
Jordan, I'm sorry I'm just getting back to you, but it's been a busy morning! I had already caught the changes that Steve suggested, so tried your suggestions out. I took the code block you provided and placed it into my project. I'm not sure if it's placed correctly or not. I'm still quite new to JavaScript, and this is a little beyond what I truly understand. Here's the pertinent portion of my code: require([
"dojo/dom-construct",
"esri/map",
"esri/Color",
"dojo/keys",
"esri/sniff",
"esri/SnappingManager",
"esri/renderers/SimpleRenderer",
"esri/config",
"esri/geometry/Extent",
"esri/geometry/webMercatorUtils",
"esri/dijit/BasemapGallery",
"esri/dijit/HomeButton",
"esri/dijit/Search",
"esri/dijit/Popup",
"esri/dijit/Scalebar",
"esri/dijit/Print",
"esri/dijit/Measurement",
"esri/InfoTemplate",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/FeatureLayer",
"esri/tasks/GeometryService",
"esri/symbols/SimpleFillSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleMarkerSymbol",
"esri/toolbars/draw",
"esri/graphic",
"esri/urlUtils",
"esri/SpatialReference",
"agsjs/dijit/TOC",
"dojo/_base/array",
"dojo/aspect",
"dojo/dom",
"dojo/ready",
"dojo/on",
"dojo/domReady!",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane",
"dijit/TitlePane",
"dijit/form/Button"],
function (domConstruct, Map, Color, keys, has, SnappingManager, SimpleRenderer, esriConfig, Extent, webMercatorUtils, BasemapGallery, HomeButton, Search, Popup, Scalebar, Print, Measurement, InfoTemplate, ArcGISDynamicMapServiceLayer, FeatureLayer, GeometryService, SimpleFillSymbol, SimpleLineSymbol, SimpleMarkerSymbol, Draw, Graphic, urlUtils, SpatialReference, TOC, array, aspect, dom, ready, on
) {
ready(function() {
esriConfig.defaults.geometryService = new GeometryService("https://conservationgis.alabama.gov/adcnrweb/rest/services/Utilities/Geometry/GeometryServer");
//Create Symbols
var popupLine = new SimpleLineSymbol ("solid", new Color("#84CCDA"), 3);
var popupFill = new SimpleFillSymbol ("solid", popupLine, new Color([134, 208, 218, 1.25]));
var drawMarker = new SimpleMarkerSymbol ();
drawMarker.setStyle(SimpleMarkerSymbol.STYLE_CIRCLE);
drawMarker.setColor(new Color("#FF0000"));
drawMarker.setOutline(null);
drawMarker.setSize("8");
var drawLine = new SimpleLineSymbol ("solid", new Color("#FF0000"), 3);
var drawFill = new SimpleFillSymbol ("null", drawLine, new Color(["#FF0000", 1.25]));
//Create Popup
var popup = new Popup({
fillSymbol: popupFill,
lineSymbol: null,
markerSymbol: null,
}, domConstruct.create("div"));
//get URL
var urlObject = urlUtils.urlToObject(window.location.href);
// Fake URL to show the params use your document.location.href code below
var urlObject = esri.urlToObject("http://your.server.com?xmin=-8526390.734225096&ymin= 4433687.484863019&xmax=-8518747.031396376&ymax=4437389.903420679");
// Define your vars - I believe they were only scoped to the if {}
var xmin, ymin, xmax, ymax;
if (urlObject.query) {
if (urlObject.query.xmin) {
xmin = urlObject.query.xmin;
}
if (urlObject.query.xmax) {
xmax = urlObject.query.xmax;
}
if (urlObject.query.ymin) {
ymin = urlObject.query.ymin;
}
if (urlObject.query.ymax) {
ymin = urlObject.query.ymax;
}
var spatialRef = new SpatialReference({
wkid: 102100
});
// I'm not sure of the exact json syntax (the wkid is a little weird) so I use the constructor
var urlPassedExtent = new Extent(xmin, ymin, xmax, ymax,spatialRef);
}
//Create initial extent
var extentInitial = new Extent({
"xmin":-10077457.809115015,
"ymin":3391939.9753557443,
"xmax":-9157767.48478802,
"ymax":4263933.594032803,
"spatialReference":{"wkid":102100}
});
... View more
01-29-2016
10:27 AM
|
0
|
3
|
2822
|
|
POST
|
In my current Flex map, I am able to pass an extent through the URL quite easily. I'm trying to update the map to JavaScript, but I'm having problems getting that same capability to work now. I am currently getting an error stating, "xmin is not defined". I'm sure I've missed something simple. Here's my code: var urlObject = esri.urlToObject(window.location.href);
if (urlObject.query)
{
if (urlObject.query.XMin)
{ xmin = urlObject.query.XMin; }
if (urlObject.query.XMax)
{ xmax = urlObject.query.XMax; }
if (urlObject.query.YMin)
{ ymin = urlObject.query.YMin; }
if (urlObject.query.YMax)
{ ymin = urlObject.query.YMax; }
var spatialRef = new SpatialReference({wkid:102100}); //set your wkid here
var urlPassedExtent = new Extent();
urlPassedExtent.xmin = xmin;
urlPassedExtent.ymin = ymin;
urlPassedExtent.xmax = xmax;
urlPassedExtent.ymax = ymax;
urlPassedExtent.spatialReference = spatialRef;
mapMain.setExtent(urlPassedExtent);
//If extent not found in URL, use initial extent
}else { mapMain.setExtent(extentInitial);
}
... View more
01-28-2016
02:26 PM
|
0
|
6
|
4772
|
|
POST
|
Good morning, My problem is very similar to the one described in this thread. The one real difference is that I've got multiple services that I'm pulling in instead of a single service. I've also already have set my InfoTemplates in a slightly different manner: var fishing = new ArcGISDynamicMapServiceLayer(fishingURL, fishingOptions);
fishing.setInfoTemplates({
1: { infoTemplate: inshoreInfoTemplate },
2: { infoTemplate: offshoreInfoTemplate },
3: { infoTemplate: offshoreInfoTemplate },
4: { infoTemplate: navAidsInfoTemplate },
5: { infoTemplate: rampsInfoTemplate},
6: { infoTemplate: lakesInfoTemplate }
}); Is creating an array the best way to go about turning the popups off in areas where there are no features, similar to what was suggested here? I also have a single service with two base layers that I don't have popups set for. Is there a way to force 'no popups' for those? Here's a link to the live version of this map that I am finalizing. I still have things I'm working on like the placement for the draw and measure tools, so be aware it's not perfect. Thanks in advance! Ashley
... View more
01-27-2016
08:22 AM
|
0
|
4
|
2629
|
|
POST
|
Jake, Yes! That was exactly what I've been looking for. My overall code has ended up looking a little different, but I had no idea it would be such a simple solution. Thank you! Ashley
... View more
01-21-2016
01:51 PM
|
0
|
0
|
1150
|
|
POST
|
I am using both the draw toolbar and the measurement dijit in my project. I'd like for the draw toolbar to have the same look and operation as the measurement dijit, so I can keep the overall appearance of my map relatively clean. Is it possible to rework the div for the draw toolbar? I feel like this might be a large task for myself, as I'm still pretty new to JavaScript. I haven't found any forum threads or information in general on making a change like this. Does anyone have experience making a similar change in their projects? Thanks in advance for any guidance! Ashley
... View more
01-21-2016
12:24 PM
|
0
|
2
|
2575
|
|
POST
|
Thanks Robert! I'd tried that call in multiple locations, but not there.
... View more
11-30-2015
09:41 AM
|
0
|
0
|
1920
|
|
POST
|
<div id="info">
<button id="close" style="position:absolute; right: 3px; top: 3px">X</button>
<button id="Point">Point</button>
<button id="Multipoint">Multipoint</button>
<button id="Line">Line</button>
<button id="Polyline">Polyline</button>
<button id="FreehandPolyline">Freehand Polyline</button>
<button id="Triangle">Triangle</button>
<button id="Extent">Rectangle</button>
<button id="Circle">Circle</button>
<button id="Ellipse">Ellipse</button>
<button id="Polygon">Polygon</button>
<button id="FreehandPolygon">Freehand Polygon</button>
</div>
... View more
11-30-2015
09:37 AM
|
0
|
0
|
1920
|
|
POST
|
All, I've added in the Draw Toolbar to my project and need to disable the popups from the map when the toolbar is in use. I've tried the solution mentioned in this thread, but didn't have any luck. I've also tried using aspect.after, which is what I had to use to disable the popups when the Measurement tool is active. How do I go about disabling popups when the draw toolbar is active? Is there a way I can handle the popup issue for the measurement and draw tools within the same snippet of code? Thanks in advance for your help! Here's the code for my draw toolbar: mapMain.on("load", initDrawTool);
function initDrawTool() {
drawToolbar = new Draw(mapMain, {
drawTime: 25,
tolerance: 4
});
drawToolbar.on("draw-end", addGraphic);
on(dom.byId("info"), "click", function (evt) {
if(evt.target.id === "info") {
return;
}
var drawTool=evt.target.id.toLowerCase();
mapMain.disableMapNavigation();
drawToolbar.activate(drawTool);
});
}
function addGraphic(evt) {
drawToolbar.deactivate();
mapMain.enableMapNavigation();
var symbol;
if ( evt.geometry.type === "point" || evt.geometry.type === "multipoint") {
symbol = drawMarker;
} else if ( evt.geometry.type === "line" || evt.geometry.type === "polyline") {
symbol = drawLine;
}
else {
symbol = drawFill;
}
mapMain.graphics.add(new Graphic(evt.geometry, symbol));
}
... View more
11-30-2015
08:16 AM
|
1
|
4
|
4079
|
|
POST
|
Thejus, Thanks for your help! Between this and the other two errors you previously found, the error has been taken care of. While I'm now getting a different error (a symbol has not been defined), I am hoping I can take care of that one myself. Thanks again! Ashley
... View more
11-16-2015
01:27 PM
|
0
|
0
|
3217
|
|
POST
|
The error is at the time of loading. I believe this link will work for jsbin: JS Bin - Collaborative JavaScript Debugging
... View more
11-16-2015
11:32 AM
|
0
|
2
|
3217
|
|
POST
|
Jeff, This toolbar widget looks quite interesting. I looked around at different draw options before I started working on this portion of my project, but did not come across yours. I'll take a closer look at it in the future. Ashley
... View more
11-16-2015
11:06 AM
|
0
|
0
|
413
|
|
POST
|
I've made these changes, but still getting the error. I'm wondering if I have put the drawToolbar.deactivate in the wrong location. Where should it go? I've tried placing it within the initDrawTool method and after all of the Draw Toolbar code. I apologize for all of the questions, but I'm still pretty new to this and the learning curve has been steep!
... View more
11-16-2015
11:04 AM
|
0
|
4
|
3217
|
|
POST
|
I tried removing the variable definition, but that didn't resolve my problem.
... View more
11-16-2015
09:29 AM
|
0
|
6
|
3217
|
|
POST
|
I noticed the question didn't make it through. I've used the sample here: https://developers.arcgis.com/javascript/jssamples/graphics_add.html. I modified it slightly for my app. I am now getting this error: Error: scriptError Stack trace: d@http://js.arcgis.com/3.14/:5:382 r.injectUrl/h<@http://js.arcgis.com/3.14/:30:159 3.14:31:442 src: dojoLoader 3.14:31:494 info: Array [ "http://js.arcgis.com/3.14/esri/tool…", error ] 3.14:31:494 . 3.14:32:11 I've made changes in the DIV and double-checked my require statement, without any luck. I also have combed through the code for the toolbar, but I don't see anything missing. Any ideas on what I may be missing? Thanks in advance for any help you can give! Here's my require statement: require([
"dojo/dom-construct",
"esri/map",
"esri/Color",
"dojo/keys",
"esri/sniff",
"esri/SnappingManager",
"esri/renderers/SimpleRenderer",
"esri/config",
"esri/geometry/Extent",
"esri/geometry/webMercatorUtils",
"esri/dijit/BasemapGallery",
"esri/dijit/HomeButton",
"esri/dijit/Search",
"esri/dijit/Popup",
"esri/dijit/Scalebar",
"esri/dijit/Print",
"esri/dijit/Measurement",
"esri/InfoTemplate",
"esri/layers/ArcGISDynamicMapServiceLayer",
"esri/layers/FeatureLayer",
"esri/tasks/GeometryService",
"esri/symbols/SimpleFillSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/SimpleMarkerSymbol",
"esri/toolbars/Draw",
"esri/graphic",
"agsjs/dijit/TOC",
"dojo/aspect",
"dojo/dom",
"dojo/ready",
"dojo/on",
"dojo/domReady!",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane"],
function (domConstruct, Map, Color, keys, has, SnappingManager, SimpleRenderer, esriConfig, Extent, webMercatorUtils, BasemapGallery, HomeButton, Search, Popup, Scalebar, Print, Measurement, InfoTemplate, ArcGISDynamicMapServiceLayer, FeatureLayer, GeometryService, SimpleFillSymbol, SimpleLineSymbol, SimpleMarkerSymbol, Draw, Graphic, TOC, aspect, dom, ready, on
) And the code for the toolbar: mapMain.on("load", initDrawTool);
function initDrawTool() {
var drawToolbar = new Draw({
map: mapMain,
drawTime: 25,
tolerance: 4
});
drawToolbar.on("draw-end", addGraphic);
on(dom.byId("info"), "click", function (evt) {
if(evt.target.id === "info") {
return;
}
var drawTool=evt.target.id.toLowerCase();
mapMain.disableMapNaviation();
drawToolbar.activate(drawTool);
});
}
function addGraphic(evt) {
drawToolbar.deactivate();
mapMain.enableMapNavigation();
var symbol;
if ( evt.geometry.type === "point" || evt.geometry.type === "multipoint") {
symbol = drawMarker;
} else if ( evt.geometry.type === "line" || evt.geometry.type === "polyline") {
symbol = drawLine;
}
else {
symbol = drawFill;
}
mapMain.graphics.add(new Graphic(evt.geometry, symbol));
} Symbols: var drawMarker = new SimpleMarkerSymbol ();
drawMarker.setStyle(STYLE_CIRCLE);
drawMarker.setColor(new Color("#FF0000"));
drawMarker.setOutline(null);
drawMarker.setSize("8");
var drawLine = new SimpleLineSymbol ("solid", new Color("#FF0000"), 3);
var drawFill = new SimpleFillSymbol ("solid", new Color(["#FF0000", 1.25])); And the DIV: <body class="nihilo">
<div id="mainWindow" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'"
style="width:100%; height:100%;">
<div id="header" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'top'">
<div id="PrintButton" style="position:absolute; right: 20px; top: 10px"></div>
<div id="title">
<a id ="logo" href="http://www.outdooralabama.com" target="_blank"><img src="images/OA_Header.png"></a>
</div>
</div>
<div data-dojo-type="dijit/layout/ContentPane" id="leftPane" data-dojo-props="region:'left'">
<div id="tocDiv"></div>
</div>
<div id="info">
<div>Select a shape then draw on map to add graphic</div>
<button id="Point">Point</button>
<button id="Multipoint">Multipoint</button>
<button id="Line">Line</button>
<button id="Polyline">Polyline</button>
<button id="FreehandPolyline">Freehand Polyline</button>
<button id="Triangle">Triangle</button>
<button id="Extent">Rectangle</button>
<button id="Circle">Circle</button>
<button id="Ellipse">Ellipse</button>
<button id="Polygon">Polygon</button>
<button id="FreehandPolygon">Freehand Polygon</button>
</div>
<div id="map" data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'center'">
<div style="position:absolute; right:20px; top:25px; z-Index:999;">
<div data-dojo-type="dijit/TitlePane" data-dojo-props="title:'Switch Basemap', closable:false, open:false">
<div data-dojo-type="dijit/layout/ContentPane" style="width:380px; height:280px; overflow:auto;">
<div id="basemapGallery"></div>
</div>
</div>
</div>
<div style="position:absolute; right:15px; bottom:50px; z-Index:999; width: 250px">
<div id="TitlePane" data-dojo-type="dijit/TitlePane" data-dojo-props="title:'Measurement', closable:false, open:false">
<div id ="measurementDiv"></div>
</div>
</div>
<span id="latlong" style="position:absolute; right:20px; top:8px; font-size:80%; color:#FFFFFF; z-index:50;"></span>
<div id="HomeButton"></div>
<div id="search"></div>
</div>
</div>
</body>
... View more
11-16-2015
08:52 AM
|
0
|
10
|
6763
|
|
POST
|
Thanks Robert! I hadn't seen that solution in previous threads. Worked perfectly!
... View more
11-10-2015
11:07 AM
|
0
|
0
|
1107
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 10-30-2025 01:35 PM | |
| 1 | 08-31-2023 01:21 PM | |
| 1 | 02-04-2025 06:23 AM | |
| 1 | 08-21-2023 01:28 PM | |
| 1 | 03-04-2024 01:50 PM |
| Online Status |
Offline
|
| Date Last Visited |
12-03-2025
11:15 AM
|