|
POST
|
currently have the following relationships: points ...| [point_to_mainTable] one point - many mainTable ...mainTable .........| [mainTable_to_subTable] one mainTable - many subTable .........subTable user clicks point and the 2 queryRelatedFeatures methods are ran, one for each related table. The records are post-processed and displayed in popup; all is well. How would I allow a user to search subTable or mainTable, in order to locate points? I could use a find task on the mainTable, grab matching records and graphic highlight joined points, but the subTable is trickier since it isn't immediately joined to points. any advice? thanks!
... View more
08-14-2012
11:25 AM
|
0
|
0
|
543
|
|
POST
|
currently running Desktop, Server, ArcSDE 10.0 planning to upgrade all to 10.1 I plan on uninstalling all 10.0 desktop and server instances, then install desktop and server 10.1. What about our SQL server express 2008 / ArcSDE 10.0 ? Do I uninstall SDE 10.0, then run the server install CD and select the SQL server 2008 option, enable gdb storage? After completing the wizard, I will have SDE 10.1? thanks
... View more
08-14-2012
09:41 AM
|
0
|
4
|
2901
|
|
POST
|
I am trying to modify the gallery sample - Public Information Map - 2.0. I want to include a dynamic map layer in the layers.js that will always be the active layer for map click events to display attributes in an info window but not appear in the Layers Menu for turning its display on and off. (It will be totally transparent and I do not want the user to even know the layer exists.) I have figured out the transparency and active for click event part but not how to remove it from the drop down Layers Menu. I would appreciate any help to this struggling beginner. I also modified this template, and in the end, it was a huge pain, and I almost ended up redeveloping the entire app. If you look, there's probably a function that adds all layer variables to an array, then later, another function loops over the array adding each layer to the legend widget. Just stop the layer in question from being added to the array and your done.
... View more
08-03-2012
05:48 AM
|
0
|
0
|
863
|
|
POST
|
from the api reference: "The name of the layer as defined in the map service."
a ->
...
id: "graphicsLayer4"
console.log(featureLayer.name) - would return the name of the layer as defined in the service. Doesn't look like you can define name, only properties listed in the 'constructor detail' section of the api reference.
... View more
08-03-2012
05:44 AM
|
0
|
0
|
1559
|
|
POST
|
found the problem. I ended up setting up a query task onLoad that fills a graphicsLayer will transparent points. I know this is duplicate data since the feature layer is already loaded/displayed on the map. However, the onMouseOver is hooked to the graphicsLayer and the onClick is hooked to the feat. layer; for me, this allows for easy switching b/t the two. Identify button enabled remove graphicsLayer disconnect graphicsLayer onMouseOver connect map onClick Identify button disabled loop over TOC and check if the layer is visible add graphicsLayer connect graphicsLayer onMouseOver disconnect map onClick
... View more
08-02-2012
06:15 AM
|
0
|
0
|
927
|
|
POST
|
I attempted this but to no avail....and ideas? <button data-dojo-type="dijit.form.Button" data-dojo-props="onClick:function(){toolbar.activate(esri.toolbars.Draw.POLYLINE);map.hideZoomSlider();dojo.disconnect(handler);}">Polyline</button> I'd put the function up in the js and remove it from your html markup. i'm doing something very similar, disabling onClick listener, enabling onMouseOver listener when load, then the opposite when identify button is clicked. search for my thread "onMouseOver onMouseOut" and you can see my markup. something like this //globals var handler; //var to hold event listener var map; var toolbar; function init(){ //define map here //define toolbar here handler = dojo.connect(map,"onClick",executeIdentifyTask); } function initToolbar(){ dojo.disconnect(handler); toolbar.activate(esri.toolbars.Draw.POLYLINE); map.hideZoomSlider(); } dojo.addonload(init); <button data-dojo-type="dijit.form.Button" data-dojo-props="onClick:initToolbar()">Polyline</button>
... View more
07-30-2012
03:27 PM
|
0
|
0
|
1311
|
|
POST
|
i'm almost there... when the map loads, the onMouseOver listener is active. Simple popups are displayed, highlightgraphic added. OnMouseOut also works removing the highlightgraphic. When the identify toggle button is clicked, onMouseOver is no longer active and executeIdentifyTask fires... so far so good. However, if you try and click a point that was previously hovered on, executeIdentifyTask is not fired, but rather, only the simple popup is displayed?? any advice? TIA!
//globals
var featlayer;
var identifyListener;
var facilsHoverHandle;
var facilsHoverHandleOut;
function init() {
featlayer = new esri.layers.FeatureLayer("url",{
mode:esri.layers.FeatureLayer.MODE_ONDEMAND,
id: 'facs',
outFields:["*"]
});
facilsHoverHandle = dojo.connect(featlayer, "onMouseOver", showHoverPopup);
facilsHoverHandleOut = dojo.connect(featlayer, "onMouseOut", hideHoverPopup);
}
function showHoverPopup(evt){
map.graphics.enableMouseEvents();
var infoTemplate = new esri.InfoTemplate();
infoTemplate.setTitle(evt.graphic.attributes.facil_name);
infoTemplate.setContent("<b>${facil_name}</b>");
map.infoWindow.resize(245,125);
var highlightSym = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([255,0,0]), 1),
new dojo.Color([0,255,0,0.25]));
evt.graphic.setInfoTemplate(infoTemplate);
var content = evt.graphic.getContent();
map.infoWindow.setContent(content);
var title = evt.graphic.getTitle();
map.infoWindow.setTitle(title);
highlightGraphic = new esri.Graphic(evt.graphic.geometry,highlightSym);
map.graphics.add(highlightGraphic);
map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
}
function hideHoverPopup(evt){
map.graphics.remove(highlightGraphic);
}
//toggles identify onClick and featlayer onMouseOver listeners on/off
function activateIdentify(){
if (dijit.byId("tool_identify").checked) {
map.infoWindow.hide();
dojo.disconnect(featlayerHoverHandle);
dojo.disconnect(featlayerHoverHandleOut);
identifyListener = dojo.connect(map, "onClick", executeIdentifyTask);
} else {
dojo.disconnect(identifyListener);
facilsHoverHandle = dojo.connect(featlayer , "onMouseOver", showHoverPopup);
facilsHoverHandleOut = dojo.connect(featlayer , "onMouseOut", hideHoverPopup);
}
}
<button dojotype="dijit.form.ToggleButton" id="tool_identify" title="Identify"
onclick="activateIdentify();" style="cursor:crosshair;">
<img src="images/infoIcon.png" width="34px" height="34px" alt="" />
</button>
... View more
07-30-2012
10:30 AM
|
0
|
0
|
927
|
|
POST
|
i guess the short answer to why do i need identifyTask is because I saw this method in the samples. Now that I look back, the identifyTask seems to only be necessary if it's a dynamicLayer? There are multiple points atop each other at full scale, and when zoomed in, multiple layers can be selected, so I stuck with the deferred = identifyTask.execute() deferred.addCallback() then switch for each featureLayer name and set infoWindow accordingly. There are also several queryRelatedFeatures tasks for some of the layers. Do you have a sample of an identify tool, I've never seen one? Do you just use a dijit.form.button? thanks!
... View more
07-19-2012
03:39 PM
|
0
|
0
|
927
|
|
POST
|
feature layer is added to map. I would like to hover and get basic info, then click and execute onClick identify task. the hover works great, the popup is displayed and the graphic is cleared onMouseOut, but as soon as the onClick is fired, it immmediately gets replaced by the basic onMouseOver popup. Im assuming this is becasue my hand isn't steady, onMouseOver -- basic popup, onClick --detailed popup, slight movement onMouseOver --basic popup. any help? function init() {
featlayer = new esri.layers.FeatureLayer("url",{
mode:esri.layers.FeatureLayer.MODE_ONDEMAND,
//infoTemplate:template,
id: 'facs',
outFields:["*"]
});
dojo.connect(featlayer, "onMouseOver", showHoverPopup);
dojo.connect(featlayer, "onMouseOut", hideHoverPopup);
dojo.connect(map,"onClick",executeIdentifyTask);
}
function showHoverPopup(evt){
map.graphics.enableMouseEvents();
var infoTemplate = new esri.InfoTemplate();
infoTemplate.setTitle(evt.graphic.attributes.facil_name);
infoTemplate.setContent("<b>${facil_name}</b>");
map.infoWindow.resize(245,125);
var highlightSym = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10,
new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID,
new dojo.Color([255,0,0]), 1),
new dojo.Color([0,255,0,0.25]));
evt.graphic.setInfoTemplate(infoTemplate);
var content = evt.graphic.getContent();
map.infoWindow.setContent(content);
var title = evt.graphic.getTitle();
map.infoWindow.setTitle(title);
highlightGraphic = new esri.Graphic(evt.graphic.geometry,highlightSym);
map.graphics.add(highlightGraphic);
map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
}
function hideHoverPopup(evt){
map.graphics.remove(highlightGraphic);
}
... View more
07-19-2012
02:25 PM
|
0
|
5
|
2052
|
|
POST
|
anyone ever get this error in manager log? It happens from time to time when someone accesses the JS api web map. Seems like it's related to the sql server sde geodatabase, I never saw the problem with a file geodatabase being hosted. directly following the spatial filter invalid error, this is always posted in manager log: Method failed.HRESULT = 0x80041251 : This is a FACILITY_ITF error that is specific to the interface that returned this error. See the documentation of the interface that returned this error for information about this HRESULT. any advice? Thanks
... View more
07-18-2012
09:58 AM
|
0
|
1
|
867
|
|
POST
|
after some brainstorming, I decided to do away with the identifyTask and replace it with a findTask when a grid row click is detected. The existing code to process the response can remain exactly the same since both the identifyTask and findTask returns a dojo.deferred incase anyone's interested, here's the solution:
function executeIdentifyTask(evt) {
if (evt.mapPoint == undefined){
//grid click, lets switch to a find task
anchorPt = evt.geometry;
siteCode = evt.attributes.site_code[0];
lids.push(0);
var findTask2 = new esri.tasks.FindTask("https://mydomain.com/MapServer/");
var fParams = new esri.tasks.FindParameters();
fParams.searchText = siteCode;
fParams.returnGeometry = true;
fParams.searchFields = ["site_code"];
fParams.layerIds = lids; //set lids to include only facil layer
fParams.contains = false;
var deferred = findTask2.execute(fParams);
}
else{
//map click;
identifyParams.tolerance = 5;
anchorPt = evt.mapPoint;
//since LAYER_OPTION_VISIBLE only pertains to scale visibility, not TOC checked/not checked, we have to manually set the identifyParams.layerIds
dojo.forEach(legendLayers, function(layer){
//layer must be checked in toc AND not be parcels, bndry or prtct;
if (layer.layer.visible === true && (!(layer.layer.id == "parcels" || layer.layer.id == "bndry" || layer.layer.id == "prtct"))){
lids.push(map.getLayer(layer.layer.id).layerId); //set lids to include all visible facilities
}
})
//click dependent identifyparams
identifyParams.layerIds = lids;
identifyParams.width = map.width;
identifyParams.height = map.height;
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParams.geometry = anchorPt;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask.execute(identifyParams);
}
deferred.addCallback(function(response) {
//set esri.dijit.PopupTemplate for each layer
});
};
... View more
07-03-2012
05:57 AM
|
0
|
0
|
421
|
|
POST
|
the executeIdentifyTask function is fired from either a map click or grid row click. Since the executeIdentifyTask is responsible for identifying/formatting/displaying popups, I'd like to use the existing executeIdentifyTask to display a popup after a grid row click. If a grid click, I want to display the popup, stripping out any close-by identify results that may have been included. If grid click, I lower the identifyParams.tolerance, but I still pickup a few unwanted results around the facility point geometry that was grid-clicked
dojo.connect(grid1, "onRowClick", onRowClickHandler);
dojo.connect(map,"onClick",executeIdentifyTask);
function onRowClickHandler(evt){
var selectedFac;
//other non-pertinent code
map.centerAndZoom(selectedFac.geometry, 15);
executeIdentifyTask(selectedFac);
}
function executeIdentifyTask(evt) {
var lids = []; //array to hold layer id's to identify
var anchorPt; //facility point, substitute for a mouse click
var siteCode; //id for the grid row that was clicked
var j; //index of response object that was grid clicked
var res; //filtered array of response objects
//lets detect if this was fired by a map click or a grid click
if (evt.mapPoint == undefined){
//grid click, only identify the facility point corresponding to the grid row that was clicked i.e. lower identify tolerance
identifyParams.tolerance = 1;
anchorPt = evt.geometry;
siteCode = evt.attributes.site_code;
//set lids to include only facil layer
lids.push(0);
}
identifyParams.layerIds = lids;
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function(response) {
if (!(siteCode == undefined)){
for (var i in response){
var fac = response;
if (fac.feature.attributes.site_code == siteCode){
j = i;
break;
}
}
res = response ;
}
else{
//no filtering the identify response; this was fired by map click
res = response;
}
return dojo.map(res, function(result) {
//if res is set to response , script never gets here, ends at break above <----problem
var feature = result.feature;
//esri.dijit.PopupTemplate's set here
return feature;
}
})
}
any advice would be great! Thanks.
... View more
07-02-2012
10:50 AM
|
0
|
1
|
758
|
|
POST
|
I occasionally get these errors in the manager error log: Method failed.HRESULT = 0x80041251 : This is a FACILITY_ITF error that is specific to the interface that returned this error. See the documentation of the interface that returned this error for information about this HRESULT. Method failed.HRESULT = 0x80070057 : The parameter is incorrect. . The error is recorded when using the identifyTask is fired, which in turn triggers a bunch of relationshipQueries. I put my code below. Usually, clearing rest Cache, restarting the service and refreshing the browser clears the problem. Anyone know what could be happening? Thanks!
function executeIdentifyTask(evt) {
identifyParams.layerIds = lids;
identifyParams.width = map.width;
identifyParams.height = map.height;
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParams.geometry = anchorPt;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function(response) {
return dojo.map(response, function(result) {
var feature = result.feature;
feature.attributes.layerName = result.layerName;
//setup case switches for each layer
switch(result.layerName){
case "Facilities":
var x = feature.geometry.x;
var y = feature.geometry.y;
var featObjId = feature.attributes.OBJECTID;
//" + getZip(feature.attributes.zip) + "
var tmpCont = "<span>{address}<br/>{facil_location}<br/>" + getZip(feature.attributes.zip) + "Acres: {acres}<br/><br/></span><div id='graphic" + featObjId + "'>{graphicCmdData}</div>";
var relatedBranch = new esri.tasks.RelationshipQuery();
relatedBranch.outFields = ["*"];
relatedBranch.relationshipId = 0; //fac -to- Branch relationshipID
relatedBranch.objectIds = [featObjId];
facSel.queryRelatedFeatures(relatedBranch, function(relatedBranches) {
var branchFound = false;
if(relatedBranches.hasOwnProperty(featObjId) == true){
branchFound = true;
var branchSet = relatedBranches[featObjId];
var cmdBranch = dojo.map(branchSet.features, function(feature){
return feature.attributes;
})
//console.log(cmdBranch);
}
//regardless of whether a branch is found or not, we have to run the cmdMain relationship query
//the parent is still fac, no advantage of the parent being branch since cmcMain query has to be run regardless
//fac - branch - cmdMain - cmdSub <--sometimes
//fac - cmdMain - cmdSub <-- sometimes
var relatedQuery = new esri.tasks.RelationshipQuery();
relatedQuery.outFields = ["*"];
relatedQuery.relationshipId = 1; //fac -to- cmdMain relationshipIP
relatedQuery.objectIds = [featObjId];
//rather then listen for "OnSelectionComplete" we are using the queryRelatedFeatures callback function
facSel.queryRelatedFeatures(relatedQuery, function(relatedRecords) {
var data = []; //this holds our branch - cmdMain - cmdSub data
//if any cmdMain records were found, relatedRecords object will have a property == to the OBJECTID of the clicked feature
//i.e. if cmdMain records are found, true will be returned; and continue with finding cmdSub records
if(relatedRecords.hasOwnProperty(featObjId) == true){
var fset = relatedRecords[featObjId]
var cmdMain = dojo.map(fset.features, function(feature) {
return feature.attributes;
})
//we need to fill an array with the objectids of the returned cmdMain records
//the length of this list == total number of mainCmd records returned for the clicked facility
objs = [];
for (var k in cmdMain){
var o = cmdMain ;
objs.push(o.OBJECTID)
}
//third relationship query to find records related to cmdMain (cmdSub)
var subQuery = new esri.tasks.RelationshipQuery();
subQuery.outFields = ["*"];
subQuery.relationshipId = 2; //cmdMin -to- CmdSub relationshipId
subQuery.objectIds = [objs]
subTbl.queryRelatedFeatures(subQuery)
//we are using the queryRelatedFeatures callback method function(subRecords) fires when the subQuery is complete
//a dojo.connect(subTbl,onSelectionComplete, function) was initially used here but it wasn't disconnecting, so it would fire multiple times
subTbl.queryRelatedFeatures(subQuery, function(subRecords){
//subRecords is an object where each property is the objectid of a cmdMain record
//if a cmdRecord objectid is present in subRecords property, cmdMain has sub records
//we no longer need these objectids, so we'll remove them and put the array into cmdsub
var cmdSub = [];
for (id in subRecords){
dojo.forEach(subRecords[id].features, function(rec){
cmdSub.push(rec.attributes)
})
}
var j = cmdSub.length;
var p;
var sub_key;
var obj;
if (branchFound == true){
var p1 = "branch";
obj1 = {};
obj1[p1] = [cmdBranch[0].Branches]
data.push(obj1)
}
for (var i=0, iLen = cmdMain.length; i<iLen; i++) {
p = cmdMain.ASGMT_Name
obj = {};
obj
= [];
sub_key = cmdMain.sub_key;
for (var j=0, jLen=cmdSub.length; j<jLen; j++) {
if (cmdSub .sub_key == sub_key) {
obj
.push(cmdSub .Long_Name);
}
}
data.push(obj);
}
//set the graphic feature.attributes.Unit_Struc to our formatted cmdData String
var cmdData = formatCmdData(data, featObjId, x, y);
feature.attributes.graphicCmdData = cmdData;
//this handles the display of the first facility record in the popup; feat.attributes.graphicCmdData handles the rest
var tmpSpan = dojo.byId("graphic" + featObjId);
if (tmpSpan != null){
tmpSpan.innerHTML = cmdData;
};
});
}
//since i'm a dumba** and can't figure out a single exit point for this function, we have to add the else clause below...
else {
p = "No Unit Data Available"
obj = {}
obj
= []
data.push(obj)
//set the graphic feature.attributes.Unit_Strucure to our formatted cmdData String
var cmdData = formatCmdData(data, featObjId, x, y);
feature.attributes.graphicCmdData = cmdData;
//this handles the display of the first facility record in the popup; feat.attributes.graphicCmdData handles the rest
var tmpSpan = dojo.byId("graphic" + featObjId);
if (tmpSpan != null){
tmpSpan.innerHTML = cmdData;
};
}
//for some reason the cmd info div was still showing after infoWindow was cosed, this fixes that
dojo.connect(map.infoWindow, "onHide", function() {dojo.destroy("obj" + featObjId);});
})
})
var template = new esri.dijit.PopupTemplate({
title: "{site_code} - {facil_name}",
description: tmpCont,
mediaInfos: [{
"title": "",
"caption": "",
"type": "image",
"value": mediaInfoPhoto(feature.attributes,"Photo_URL")
}]
});
feature.attributes.graphicCmdData = "Processing...";
feature.setInfoTemplate(template);
break;
}
return feature;
});
});
// InfoWindow expects an array of features from each deferred
// object that you pass. If the response from the task execution
// above is not an array of features, then you need to add a callback
// like the one above to post-process the response and return an
// array of features.
map.infoWindow.resize(265,300)
map.infoWindow.setFeatures([ deferred ]);
map.infoWindow.show(anchorPt);
}
... View more
05-23-2012
12:12 PM
|
0
|
0
|
1683
|
|
POST
|
I am very new to webapi, so pardon me if my questions are too simple. I developed a map at arcgis.com with added layers from files. then i developed a webmap using the basic viewer and uploaded it to a webserver. it seems to be working. however the Print function will not work. when I click on it, it will change from Print to Printing then back to Print, but nothing happened. assuming the print button on your web app is using the Print Widget or printTask have a look at this requirement: "requires an ArcGIS Server 10.1 Export Web Map Task." so, perhaps you could add a ref to esri's 10.1 server if you dont' have 10.1 running yet; I'm not sure this is possible though??
... View more
05-08-2012
01:08 PM
|
0
|
0
|
533
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-02-2024 04:44 PM | |
| 1 | 11-04-2025 11:45 AM | |
| 1 | 10-31-2025 06:53 AM | |
| 1 | 02-06-2019 06:41 AM | |
| 1 | 02-18-2025 11:55 AM |
| Online Status |
Offline
|
| Date Last Visited |
04-07-2026
07:13 AM
|