POST
|
I created a basic map displaying Rest Services A, B & C using the "ArcGIS Viewer For Flex Prerelease" GUI, then c/p the app directory to: https://gis.mydomain.com/flexmap I then created a similar map using the JS API and hosted the web app here: https://gis.mydomain.com/jsmap When the client visits the flex map, everything is fine, but when the JS map is viewed, Internet Explorer displays "IE has blocked this website from displaying content with security certificate errors". After the alert ribbon is clicked, you can choose "display blocked content" and everything works. What in the JS api would be causing this? here's how the api si referenced: <script type="text/javascript" src="https://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.8"></script> thanks!
... View more
04-24-2012
11:41 AM
|
0
|
3
|
503
|
POST
|
Thanks I've added your code but it's still not working. It still identifies sublayers which are turned off in the layerlist. I thought it is something with the lids and the build layer list. But I can't really pinpoint it. i should have added, my map contains all featureLayers. I then add the layer definition info to a legendLayers array; pretty sure I got this from the visible layers sample.
var legendLayers = []
var parcels = new esri.layers.FeatureLayer("restURL",{
mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
id: 'parcels',
outFields:["*"]
});
legendLayers.push({layer:parcels,title:"Property Boundaries"});
after the click event, you loop over the legendLayers array, checking to see which layers are visible; if visible, add the layerId to the lids array. console.log(lids) will tell you what layerId's are currently visible
... View more
04-24-2012
05:03 AM
|
0
|
0
|
1294
|
POST
|
weird that I have this problem; i'm not filling a previously created div, I'm setting the dijit.popup to pull the already formatted query result string, i.e. description: function(getmystring)?? If i console.log(map.infoWindow.features[0].infoTemplate.info.description) my data string is there, but it's not displayed on the popup?
... View more
04-23-2012
05:55 PM
|
0
|
0
|
1265
|
POST
|
thanks so much for your help!! I'm finally able to queryrelatedfeatures() and insert the string formatted results into popup, but when a single feature is clicked, nothing shows up in the popup?? If > 1 feature is clicked, the second feature, after hitting the next button on popup displays fine?? Here's what I have
function executeIdentifyTask(evt) {
//since LAYER_OPTION_VISIBLE only pertains to scale visibility, not TOC checked/not checked, we have to manually set the identifyParams.layerIds
var lids = [];
dojo.forEach(legendLayers, function(layer){
if (layer.layer.visible === true){
lids.push(map.getLayer(layer.layer.id).layerId)
}
})
console.log(lids);
identifyParams.layerIds = lids;
identifyParams.width = map.width;
identifyParams.height = map.height;
identifyParams.layerOption = esri.tasks.IdentifyParameters.LAYER_OPTION_VISIBLE;
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function(response) {
// response is an array of identify result objects
// Let's return an array of features.
return dojo.map(response, function(result) {
var feature = result.feature;
feature.attributes.layerName = result.layerName;
switch(result.layerName){
case "RSC63D.DBO.logistics2":
var template = new esri.dijit.PopupTemplate({
title: "{site_code}",
description: "Type: {Type} <br /> Shop: {SHOP}"
});
feature.setInfoTemplate(template);
break;
case "RSC63D.DBO.query2":
var featObjId = feature.attributes.OBJECTID_1;
var relatedBranch = new esri.tasks.RelationshipQuery();
relatedBranch.outFields = ["*"];
relatedBranch.relationshipId = 1; //fac -to- Branch
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);
}
var relatedQuery = new esri.tasks.RelationshipQuery();
relatedQuery.outFields = ["*"];
relatedQuery.relationshipId = 0; //fac -to- cmdMain
relatedQuery.objectIds = [featObjId];
//rather then listen for "OnSelectionComplete" we are using the queryRelatedFeatures callback function
facSel.queryRelatedFeatures(relatedQuery, function(relatedRecords) {
var data = []
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;
subQuery.objectIds = [objs]
subTbl.queryRelatedFeatures(subQuery)
dojo.connect(subTbl,"onQueryRelatedFeaturesComplete",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);
}
//format data array here
var template = new esri.dijit.PopupTemplate({
title: "something",
description: formatCmdData(data)
});
var template = new esri.InfoTemplate("",formatCmdData(data));
feature.setInfoTemplate(template);
});
}
else {
p = "No Data Available"
obj = {}
obj
= []
data.push(obj)
//format data array here
var template = new esri.dijit.PopupTemplate({
title: "{site_code} - {facil_name}",
description: formatCmdData(data)
});
feature.setInfoTemplate(template);
}
})
})
break;
}
console.log(feature)
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.setFeatures([ deferred ]);
map.infoWindow.show(evt.mapPoint);
}
... View more
04-23-2012
01:13 PM
|
0
|
0
|
1265
|
POST
|
I wish I had an answer... this is interesting; a method of firing a js script from inside a popup to retrieve content that's not in the identify featureset attributes?? I could really use something like this to display related data in a popup, but can't figure out how to return queryrelatedfeatures() results to the popup.
... View more
04-20-2012
11:22 AM
|
0
|
0
|
1265
|
POST
|
I was having the same issue. identifyParams.LAYER_OPTION_VISIBLE would still identify layers that are hidden (not checked in the dijit.legend). I *think* the LAYER_OPTION_VISIBLE pertains to the scale visibility, set in either the rest service or when the feat. layer is added to the map. So, if your at a scale within the layer visible scale range, it will identify, regardless if it's 'turned on' or not in the dijit.legend widget. I even tried adding LAYER_OPTION_VISIBLE param to the begining of the click event, so the layer visibility list would be 'more up to date' but it didn't work. I did find that the identifyParams.layerIds does restrict the identify layers, so I simply added this to the beginning of the onClick function, prior to identifyTask.execute(identifyParams):
//lets manually set the identifyParams.layerIds
//to the layers that are currently checked in the legend widget
var lids = [];
dojo.forEach(legendLayers, function(layer){
if (layer.layer.visible === true){
lids.push(map.getLayer(layer.layer.id).layerId)
}
});
identifyParams.layerIds = lids;
... View more
04-20-2012
08:57 AM
|
0
|
0
|
1294
|
POST
|
In my top header I have a table, each cell containing a button; here's the html for the basemap dropdown. I used a form DropDownButton & dijit Menu.
<td align="center" style="width: 60px;" valign="middle">
<button id="dropdownButton" iconClass="btnImgBaseMap" title="Switch Basemap" dojoType="dijit.form.DropDownButton">
<div dojoType="dijit.Menu" id="bingMenu">
<!--The menu items are dynamically created using the basemap gallery layers-->
</div>
</button>
</td> here's my createbasemap function
function createBasemapGallery() {
var streetBasemapURL = new esri.dijit.BasemapLayer({
url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"
});
var topoBasemapURL = new esri.dijit.BasemapLayer({
url:"https://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer"
});
var basemaps= [];
var bingBasemap = new esri.dijit.Basemap({
id: "Bing",
layers:[new esri.dijit.BasemapLayer({
type: "BingMapsAerial"})
],
title:"BingImagery"
//thumbnailUrl:"images/imagery_thumb.png"
});
basemaps.push(bingBasemap);
var streetBasemap = new esri.dijit.Basemap({
id: "Street",
layers:[streetBasemapURL],
title:"Street"
//thumbnailUrl:"images/street_thumb.png"
});
basemaps.push(streetBasemap);
var topoBasemap = new esri.dijit.Basemap({
id: "Topo",
layers:[topoBasemapURL],
title:"Topo"
//thumbnailUrl:"images/topo_thumb.png"
});
basemaps.push(topoBasemap);
var basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: false,
bingMapsKey: 'mykey',
basemaps: basemaps,
map: map
});
basemapGallery.startup();
dojo.forEach(basemapGallery.basemaps, function(basemap) {
//Add a menu item for each basemap, when the menu items are selected
dijit.byId("bingMenu").addChild(new dijit.MenuItem({
label: basemap.title,
iconClass: basemap.title,
onClick: function(){basemapGallery.select(basemap.id)}
}));
});
}
For the Thumbnail images, pay attention to the iconClass: basemap.title when the dijit.MenuItem is built. In my CSS I have the following classes defined
.BingImagery {
background-image: url("images/imagery_thumb.png");
background-repeat: no-repeat;
height: 60px;
width: 60px;
}
.Street {
background-image: url("images/street_thumb.png");
background-repeat: no-repeat;
height: 60px;
width: 60px;
}
.Topo {
background-image: url("images/topo_thumb.png");
background-repeat: no-repeat;
height: 60px;
width: 60px;
}
... View more
04-18-2012
05:26 AM
|
0
|
0
|
351
|
POST
|
maybe this is easier, but still related to my popup question... I click select a feature, then query 3 different related tables for info and combine into an array of objects called data. Could someone help me get data out of the following function? return {data:data}; //doesn't work
function findRelatedRecords(features,evtObj){
var selFeat = features
var featObjId = selFeat[0].attributes.OBJECTID_1
var relatedBranch = new esri.tasks.RelationshipQuery();
relatedBranch.outFields = ["*"];
relatedBranch.relationshipId = 1; //fac -to- Branch
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;
})
}
//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 = 0; //fac -to- cmdMain
relatedQuery.objectIds = [featObjId];
//rather then listen for "OnSelectionComplete" we are using the queryRelatedFeatures callback function
facSel.queryRelatedFeatures(relatedQuery, function(relatedRecords) {
var 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)
}
//second relationship query to find records related to cmdMain (cmdSub)
var subQuery = new esri.tasks.RelationshipQuery();
subQuery.outFields = ["*"];
subQuery.relationshipId = 2;
subQuery.objectIds = [objs]
subTbl.queryRelatedFeatures(subQuery)
//when the cmdMain to cmdSub query gets finished fire this function
dojo.connect(subTbl,"onQueryRelatedFeaturesComplete",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);
}
//showWin(data,evtObj)
return {data:data};
})
}
//no returned cmdRecords; cmdData not available
else{
p = "No Data Available"
obj = {}
obj
= []
data.push(obj)
}
//showWin(data,evtObj)
return {data:data};
})
})
}
function newFunc (){
var dataArray = findRelatedRecords(feat,evt)
console.log(dataArray) //would like to access data array here??
}
... View more
04-17-2012
02:17 PM
|
0
|
0
|
594
|
POST
|
my problem is kind of complex (for me atleast) I Have 5 different feature layers added to the map, 2 point, 3 poly. At full scale, I'd like user's to be able click over a point and have an infoWindow display the attributes, but due to scale, they will likely select 5 total points (example): 2 pts on featlayer1 3 pts on featlayer2 (we wont' get into the poly featlayers for now) If I opt to use the built-in map.infoWindow I can use tabs to display featlayer1 & featlayer2 and their respective features, like so: featlayer1 - Tab ---Table ------Row1 - graphic.attributes.field1, graphic.attributes.field3 ------Row2 - graphic.attributes.field1, graphic.attributes.field3 featlayer2 - Tab ---Table ------Row1 - graphic.attributes.field1, graphic.attributes.field8 ------Row2 - graphic.attributes.field1, graphic.attributes.field8 ------Row2 - graphic.attributes.field1, graphic.attributes.field8 Is this a workaround for native map.infoWindow not being able to display an array of esri.tasks.IdentifyTask results?? My other option is to replace the map.infoWindow with the popup class, which would then accept an array of esri.tasks.IdentifyTask results?
... View more
04-17-2012
09:18 AM
|
0
|
0
|
594
|
POST
|
The gdb I'm connecting to was created when I was using the SDE personal license; now, after i've switched to an SDE Workgroup license, it seems like the gdb still only accepts the max. # of personal license connections; almost as if this wasn't updated. I'll try creating new gdb and see what happens.
... View more
04-17-2012
06:13 AM
|
0
|
0
|
3070
|
POST
|
when replacing the map's default infoWindow with the popup class, how do you insert .tabContainer - with 2 (tabs) ContentPanes?
map.infoWindow.setContent(getWindowContent(secondTabContent,evtObj.graphic))
function getWindowContent(secondTabContent,graphic){
//make a tab container
var infoTabCont = new dijit.layout.TabContainer({
style: "width: 100%;height:100%;background-color:transparent;"
}, dojo.create("div", {doLayout:"false" }));
//display attribute info in first tab
var cp1 = new dijit.layout.ContentPane({
style: "background-color:transparent;color:White;",
title: "Details",
content: "FacID: " + graphic.attributes.site_code + "<br /> Fac Name: " + graphic.attributes.facil_name
})
//create 2nd tab for future related info
var cp2 = new dijit.layout.ContentPane({
style: "background-color:transparent;color:white;overflow:auto;",
title: "Cmd Structure",
content: str
})
//add the content panes to the tab container
infoTabCont.addChild(cp1);
infoTabCont.addChild(cp2);
return infoTabCont.domNode;
}
the above results in something like the attached
... View more
04-16-2012
02:15 PM
|
0
|
4
|
1736
|
POST
|
Still having 'max number of connections to instance exceeded' problems... At the time I originally posted, I was using the ArcGIS-Desktop Standard License for the ArcSDE install; thus, I only had ArcSDE Personal with 3 connection limit. Since then, I activated ArcSDE using the ArcGIS-Server Standard License and now, right click/properties on the db server in ArcCatalog, it displays "Class: ArcSDE Workgroup Server", which I *think* gets 10 connections? Here's my connection list to the SDE GDB: gdb_A --- Rest Service 1 (instances in use/running: 0/1) gdb_A --- Rest Service 2 (instances in use/running: 0/2) gdb_A --- Attempt to connect to the sde gdb via ArcCatalog <---Failed to connect, Max. # of connections exceeded. Why does this happen, I have ArcSDE Workgroup, shouldn't I get 10 connections? I can only total up 3 above, and the ArcCatalog connection would be 4 ?? thanks!
... View more
04-16-2012
09:22 AM
|
0
|
0
|
3070
|
POST
|
I started a new project and for now I only have a test environment on my local computer with Arcgis Server 10. I have some secure services and some users are allowed to view them and some not. The security is set to be windows integrated authentication. The challange is that all users must use the same homepage. This page will load all services and the goal is that only the services the users is allowed to will be visible for that user. I thought I could handle this by only catching error 401.2 from the IIS when a user is denied but it seems like it doesn´t work although I through a debugging tool can see the error being fired. Something like this try { Mylayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://Myserver/ArcGIS/rest/services/test/Mylayer/MapServer"); map.addLayer(Mylayer ); } catch(err) { //Mark up that the service is not loaded and just smoothly go on } My second problem is that the layer is loaded even if I as a user shouldn´t have access to it. My username is not in the group that has access to it and the 401 error is correctly fired. So first I need opinions on this being a good idea in the first place to trying to load all services even if a user is only authenticated to some? Is this an ok approach? And secondly if anyone having an idea on whats going on with my user accessing the secured layer even if 401 is fired? (Has it to do with me doing this on my local computer?) Hope someone here can help "from the same homepage" - are you creating a custom login page to view /rest/services ? In manager, under security/settings, do you have security enabled? On the same page, under security stores, have you configured the server to use windows auth? In manager, for each service, have you selected the padlock icon and configured windows groups for each service? In IIS manager, arcgis/rest, arcgis/security do you have an auth. method selected "basic auth" "digest", ect...? I went through quite the hassle getting service auth. properly setup on our server a month ago. When using windows auth, I would get presented with a login window when visting http://isnt/arcgis/services/rest, but I could not login with valid username/pw. I almost pulled my hair out. The problem was that the GIS server was also a domain controller, and when specifying windows groups for the service security (padlock icon) I was adding groups from the 'local comptuer', not from the 'domain'. After the group was added from the domain, all was well!! If I were you, I'd save myself a lot of headache and setup SQL database auth. Best part is that users/roles can be added/deleted from manager, so you dont' have to remote into the GIS server and mess with windows users/groups; which in my case was complicated given my lack of knowledge of winblows, and Active Directory.
... View more
04-11-2012
08:50 AM
|
0
|
0
|
328
|
POST
|
I'm struggling trying to construct a relationshipQuery that populates an infoTemplate
var template = new esri.InfoTemplate();
template.setTitle("${site_code} - ${facil_loca}");
template.setContent(getWindowContent);
map.infoWindow.resize(250,250);
var facils = new esri.layers.FeatureLayer("https://mydomain.com/MapServer/0",{
mode:esri.layers.FeatureLayer.MODE_SNAPSHOT,
infoTemplate:template,
id: 'facils',
outFields:["*"]
}); on feature click, getWindowContent() is fired, which constructs the infowindow dijit.layout's
function getWindowContent(graphic){
//make a tab container
var infoTabCont = new dijit.layout.TabContainer({
style: "width: 100%;height:100%;background-color:transparent;"
}, dojo.create("div"));
//display attribute info in first tab
var cp1 = new dijit.layout.ContentPane({
style: "background-color:transparent;color:White;",
title: "Details",
content: "FacID: " + graphic.attributes.site_code + "<br /> Fac Name: " + graphic.attributes.facil_name
})
//create 2nd tab for related info
var cp2 = new dijit.layout.ContentPane({
style: "background-color:transparent;color:White;",
title: "Cmd Structure",
content: getRelatedData(graphic) //this is the problem <-----------
})
//add the content panes to the tab container
infoTabCont.addChild(cp1);
infoTabCont.addChild(cp2);
return infoTabCont.domNode;
} the content for the second tab fires getRelatedData(), which *should* construct a relationshipQuery and return related data to populate the infowindow tab
function getRelatedData(graphicObj){
var objid = graphicObj.attributes.OBJECTID_1
var relatedFacMain = new esri.tasks.RelationshipQuery();
relatedFacMain.outFields = ["*"];
relatedFacMain.relationshipId = 0;
relatedFacMain.objectIds = [objid];
graphicObj.queryRelatedFeatures(relatedFacMain, function(relatedRecords) {
console.log(relatedRecords)
})
} on feature click, I get the following warning in firebug: "graphicObj.queryRelatedFeatures is not a function" I know all the parameters for the relationshipquery are correct, I plugged them into the relationshipquery sample and it works fine. any advice? thanks!
... View more
04-10-2012
07:18 AM
|
0
|
0
|
733
|
POST
|
I am guessing your props layer is poly's with null fill. I wonder if that is causing the bug. Try going to the Legend of the rest service directly and see if you get the error in firebug. correct; props is poly outline with 'no color' fill in the .mxd. I looked at the rest MapServer/legend and it displayed correctly. It's weird; it works fine in v2.5 or v2.6. I can't test < 2.5 because props is a secured layer (identityManager) edit: Your def. onto something here though. I added fill to the poly in the .mxd, cleared /rest cache, restarted service, changed to v2.8 and no error in firebug and everything worked fine. So, for me, looks like it's v2.6 for now.
... View more
04-09-2012
08:49 AM
|
0
|
0
|
1298
|
Title | Kudos | Posted |
---|---|---|
2 | 06-21-2024 03:34 PM | |
1 | 11-10-2023 05:45 PM | |
3 | 01-18-2024 07:57 AM | |
3 | 08-29-2023 07:50 AM | |
1 | 05-10-2021 07:48 PM |
Online Status |
Offline
|
Date Last Visited |
3 weeks ago
|