|
POST
|
Apparently my HTML markup is over the 10k character limit for posts so I'm going to break it out over a couple posts in this thread. The initMap function I call within dojo.Ready is located in my mapFunctions.js file. That's also where all my dojo.require statements are. Here's that stuff: //=============================================================================
// Global declarations and dependencies
//=============================================================================
dojo.require("esri.graphic");
dojo.require("esri.map");
dojo.require("esri.dijit.BasemapGallery");
dojo.require("esri.dijit.InfoWindow");
dojo.require("esri.dijit.Popup");
dojo.require("esri.dijit.Scalebar");
dojo.require("esri.layers.FeatureLayer");
dojo.require("esri.layers.KMLLayer");
dojo.require("esri.tasks.query");
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.form.Button");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.Menu");
dojo.require("dojo.date.locale");
dojo.require("dojo.parser");
dojo.require("dojox.grid.DataGrid");
dojo.require("dojo.data.ItemFileReadStore");
var rdClosuresShown = 1;
var trafficCamShown = 0;
var streamGageShown = 0;
var snowRoutesShown = 0;
var iceRemovalShown = 0;
var wsdotAlertsShown = 0;
var rdClosureWdgt;
var trafficCamWdgt;
var snowRteWdgt;
var icingRteWdgt;
var gageWdgt;
var wsdotWdgt;
var map;
var mapLayers = [];
var popup, template;
var wsdotTemplate;
var theBasemap, theFeatureLayer, theCountiesLayer;
var basemapGallery;
var theSnowRemovalLayer, theWsdotCamLayer, theWsdotAlertLayer;
var initExtent;
//Update today's date on the webpage
var dToday = new Date().toLocaleDateString();
var SERVERPATH = "http://...";
//=============================================================================
// Main routine for initializing the Map
//=============================================================================
function initMap() {
.
.
.etc
}
... View more
09-26-2013
10:59 AM
|
0
|
0
|
4381
|
|
POST
|
I'm revisiting an application I started putting together using the 2.8 API. I'm not quite ready for AMD dojo so I was updating the API version to 3.4 but now I get a dojo parse error pretty much as the page loads. The error points to the API but I realize that's not the true source of the issue. While reading some of the documentation about dojo.parser, I got the impression that it's focused on the HTML side of your development and not necessarily the javascript code that you write. Is this correct? I don't have a ton of dojo items (borderContainer, ContentPane, BasemapMenu, DataGrid) so it shouldn't be this hard to figure it out but I'm having a hell of a time doing so. Should I be focusing my attention on the HTML markup or my javascript code? I've tried setting a breakpoint on the first line of code in my init() function but the parse error already fires before the code execution hits the breakpoint. Thanks! Steve
... View more
09-26-2013
10:10 AM
|
0
|
12
|
13058
|
|
POST
|
FINALLY! Thanks, Jason for catching that. After making the change, everything works like I want it to. Sometimes it certainly pays to have another set of eyes! Thanks again.
... View more
09-20-2013
01:32 PM
|
0
|
0
|
1374
|
|
POST
|
I have an application that I'm trying to extend by adding the ability for my users to add a graphic point, line, or polygon and then use that graphic as part of some analysis that I've developed. I'm using this sample's code as the basis for my code to add a user drawn graphic. This all worked fine when it was just adding the graphic to the default map graphics layer. Because I wanted to have popups for the graphics that a user adds, I decided that I wanted to create a graphicsLayer to house any user drawn graphics. I've defined the graphicsLayer this way: var graphicsTemplate = new esri.InfoTemplate(); graphicsTemplate.setTitle('Custom Project'); graphicsTemplate.setContent(graphicsLayerContent); //Define the Graphics Layer which contains the user drawn "projects" theGLayer = new esri.layers.GraphicsLayer({ id: "gLayer", opacity:0.80, visible:true }); theGLayer.setInfoTemplate(graphicsTemplate); map.addLayer(theGLayer); Within my application, I've set things up to basically operate like the ESRI sample I linked above. My function to add the graphic that the user draws is the following: function addGraphic(evt) { //deactivate the toolbar and clear existing graphics tb.deactivate(); map.enableMapNavigation(); theGLayer.clear(); //map.graphics.clear(); // figure out which symbol to use var symbol, g; if ( evt.type === "point" || evt.type === "multipoint") { symbol = markerSymbol; } else if ( evt.type === "line" || evt.type === "polyline") { symbol = lineSymbol; } else { symbol = fillSymbol; } attributes = {"ProjTitle": dojo.attr("intPrjName","value"),"projLimits": dojo.attr("intPrjLimits","value")}; g = new esri.Graphic(evt, symbol, attributes, null); theGLayer.add(new esri.Graphic(g)); //map.graphics.add(new esri.Graphic(evt, symbol)); } My code throws no errors and adds a graphic to the graphicsLayer (theGLayer.graphics.length =1) but it isn't visible. If I add a point, the X,Y coordinates of the stored graphic point match the X,Y coordinates of the evt object and the spatialReference of the graphic matches the spatialReference of the map. Everything tells me that the layer is visible but I don't see my graphics when I add them. What am I missing?? Thanks! Steve
... View more
09-20-2013
01:11 PM
|
0
|
3
|
1893
|
|
POST
|
I believe you'll need to use a GeometryService to project the webMercator extent into the projection of your choice. Maybe this sample will steer you in the right direction: Project A Point
... View more
09-17-2013
11:21 AM
|
0
|
0
|
993
|
|
POST
|
The process would be something like this: Create a new popup / infoWindow for your app as shown in all the examples For each layer that needs a popup, create an infoTemplate and then specify it during the layer creation Create on onClick event listeners (dojo.connec in legacy Dojo) for each layer which contains a query on the layer Here's some cobbled together legacy code (v3.3 of the API) as a guide: var usgsTemplate = new esri.InfoTemplate();
usgsTemplate.setContent('<table cellspacing=\"5\" style=\"font-size:90%\"><tr><td style=\"text-align:top\"><b>Gage Location:</b></td><td style=\"vertical-align:top\">${NAME}</td></tr><tr><td style=\"vertical-align:top\"><b>Latest Graph:</b></td><td style=\"vertical-align:top\"><a href=\"${url}\" target=\"_blank\">Click to View<\a></td></tr></table>');
usgsTemplate.setTitle('USGS Stream Gage');
var floodplainTemplate = new esri.InfoTemplate();
floodplainTemplate.setContent(setFloodplainPopupContent);
floodplainTemplate.setTitle('100-Year Floodplain');
popup = new esri.dijit.Popup({
fillSymbol: new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.25]))
}, dojo.create("div"));
// Create the map
map = new esri.Map("map", {
extent:initExtent,
minScale: 4750000,
basemap: 'streets',
infoWindow:popup,
outFields: ["*"]
});
theUsgsLayer = new esri.layers.FeatureLayer(SERVERPATH + "/hydrography/swmStreamGages/MapServer/0", {
id: 'usgsGageLayer',
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
infoTemplate:usgsTemplate,
outFields: ["*"],
visible: true
});
theFloodplainLayer = new esri.layers.FeatureLayer(SERVERPATH + "/environmental/femaFloodPlain/MapServer/0", {
id: 'femaFloodplainLayer',
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
infoTemplate:floodplainTemplate,
outFields: ["*"],
opacity:0.35,
visible: false
});
.
. //Later on in the init() function...
.
.
//Listener event for feature selection and the popup info widow
dojo.connect(theUsgsLayer,"onClick",function(evt){
//Listener event for feature selection and the popup info widow
var query = new esri.tasks.Query();
query.geometry = pointToExtent(map,evt.mapPoint,15);
var deferred = theUsgsLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW);
map.infoWindow.resize(350,300);
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(evt.mapPoint);
});
//Listener event for feature selection and the popup info widow
dojo.connect(theFloodplainLayer,"onClick",function(evt){
//Listener event for feature selection and the popup info widow
var query = new esri.tasks.Query();
query.geometry = pointToExtent(map,evt.mapPoint,15);
var deferred = theFloodplainLayer.selectFeatures(query,esri.layers.FeatureLayer.SELECTION_NEW);
map.infoWindow.resize(200,175);
map.infoWindow.setFeatures([evt.graphic]);
map.infoWindow.show(evt.mapPoint);
});
Hope that points you in the right direction. You can also search the forum for identifyTask an popup/infoWindow and you might find some other examples. Good luck! Steve
... View more
09-04-2013
01:57 PM
|
0
|
0
|
828
|
|
POST
|
Unlike ArcGlobe which uses disk caching, ArcScene's performance is strictly tied to the computer's physical memory. In addition to a beefy graphics card, I would also max out the memory in the PC's motherboard (12-16Gb).
... View more
09-04-2013
11:15 AM
|
0
|
0
|
1070
|
|
POST
|
Maybe I'm misunderstanding your issue but I was able to draw a polyline using the tool under the "Draw/Buffer Shapes" pane and buffer it using your site under IE-8 (see attached screenshot). Steve
... View more
08-23-2013
03:12 PM
|
0
|
0
|
1182
|
|
POST
|
I seem to recall Derek mentioning in a JavaScript API session at the ESRI UC this year that they are looking towards developing something that only loads what your code requires. No timelines, of course..
... View more
08-21-2013
02:17 PM
|
0
|
0
|
1156
|
|
POST
|
Am I missing something? There's an event you can connect to for mouse out of a map but not mouse enter? Steve
... View more
08-15-2013
02:31 PM
|
0
|
2
|
1130
|
|
POST
|
I was curious so I did some searching in the forum. I found this thread which addresses another issue about webmap layers but I thought that it might be a way to "hook" into the layer you need to hide your popups. Once you have that link to the layer, maybe then you can follow the advice I originally gave? (I'm just grasping at some straws for ya :D) Steve
... View more
08-15-2013
01:36 PM
|
0
|
0
|
2599
|
|
POST
|
Ok, shoot, now I see the problem you have. I don't have any experience working with an imported webmap like you describe so hopefully someone else can chime in!
... View more
08-15-2013
01:22 PM
|
0
|
0
|
2599
|
|
POST
|
I don't know about disabling the popups but you can always add some contingency code to hide the popups when you would want- Add global boolean variable such as "var hidePopup = false;" At the start of when you'd like to not have popups show up, calc the variable to true: 'hidePopup = true;" when the process of hiding the popup is done, just calc the variable back to false Lastly, in your listener function for the features add some code such as: dojo.connect(theFeatureLayer, "onClick", function() {
if (hidePopup) {
map.infoWindow.Hide();
} else {
etc....
}
}); Steve
... View more
08-15-2013
12:44 PM
|
0
|
0
|
2599
|
|
POST
|
In the example you linked, a graphic representation is added to the map which shows the 1 mile buffer. The code "map.graphics.clear" just removes that graphic and doesn't do anything with respect to any selected features. If you selected features from a feature layer, simply call <your layer>.clearSelection()
... View more
08-07-2013
01:40 PM
|
0
|
0
|
1070
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | Thursday | |
| 2 | Thursday | |
| 2 | 05-21-2026 01:51 PM | |
| 1 | 03-12-2026 01:43 PM | |
| 1 | 03-12-2026 08:41 AM |