POST
|
Is there a way to use layer.hide(); for multiple layers in a single function? I need to hide several layers at once, and the order they're in seems to be affecting its function. I have this:
bikeLayer.hide();
mopedLayer.hide();
atmLayer.hide();
recLayer.hide();
foodLayer.hide();
as part of a larger function. if bikeLayer is turned on, I can hide it. if only atmLayer is on, it won't shut off, with the error that bikeLayer is not defined. How can I do this?
... View more
10-25-2011
01:51 PM
|
0
|
1
|
572
|
POST
|
Thanks for catching that, Kelly. That got the InfoTemplate working just perfectly. I must have looked at that line a dozen times and never caught it. James, it looks like you might have the same typo in the code you originally posted. Does changing outfields to outFields fix your problem, too?
... View more
10-19-2011
09:00 AM
|
0
|
0
|
166
|
POST
|
That was how I got my other layers to work- when they were all in the same init function, only one field showed up. This is the layer I can't get to work:
function parkinginit(){
var parkinfo = new esri.InfoTemplate("Parking Info", "${*}")
parking = new esri.layers.FeatureLayer("http://studentgisserver.uww.edu/ArcGIS/rest/services/campus/MapServer/5", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outfields: ["*"],
infoTemplate: parkinfo
});
map.addLayer(parking);
}
I can't see anything different or wrong from any of the other layers that do work. Here's the example on ArcGIS Online. As you can see, it can find the fields here. http://bit.ly/oN1UUr Here's a web example showing how the parking lot infotemplate does not work properly. http://studentgisserver.uww.edu/javamapsearch.html
... View more
10-18-2011
09:24 AM
|
0
|
0
|
642
|
POST
|
Ok well I'm in the same boat as you. I have just verified that I can see all attributes in arcgis.com and in ArcMap. Is this something we should report? Would you mind posting your work around? Do you mean you use map.addlayer() rather than adding all feature layers at once? I'm more than happy to do something hacky. Thanks, James I used this to add each layer individually. It's added content in the InfoTemplate for all but one problem layer. function showFood(){
var Foodinfo = new esri.InfoTemplate("<b>${Name}</b>", "${op1}");
Food = new esri.layers.FeatureLayer("http://studentgisserver.uww.edu/ArcGIS/rest/services/campus/MapServer/6", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
infoTemplate: Foodinfo
});
map.addLayer(Food);
}
function showRec(){
var recinfo = new esri.InfoTemplate("Recreation Area", "<b>${Name}</b>")
Rec = new esri.layers.FeatureLayer("http://studentgisserver.uww.edu/ArcGIS/rest/services/campus/MapServer/2", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
infoTemplate: recinfo
});
Rec.setOpacity(0.55);
map.addLayer(Rec);
}
... View more
10-18-2011
08:28 AM
|
0
|
0
|
642
|
POST
|
No, I haven't really found a solution. I had this problem with multiple feature layers in my map. I solved it (to some degree) by adding each layer as a new function on the map, but one layer still won't display attribute fields properly. Like I said, it's only an error in the javascript API. ArcGIS Online and ArcMap show all attributes.
... View more
10-14-2011
10:09 AM
|
0
|
0
|
642
|
POST
|
I'm having this problem, too. I've made sure the feature has attributes for all fields, but the only field that will show up is FID. Even using ${*} doesn't work in the InfoTemplate. Putting the layer into ArcGIS.com and enabling a popup there shows all fields correctly.
... View more
10-11-2011
11:43 AM
|
0
|
0
|
642
|
POST
|
Is there a way to have Javascript's If/Then statements work from a polygon's attributes? I was just wondering since it would be a great way to add functionality to a web application. I'm developing a building floor plan map, and would like the search function to be able to automatically switch to a room's given floor automatically. Something like (this is just a rough idea) if floor = "1" then [run function that shows floor one], else if floor = "2" [run function that shows floor two] and so on. Has anybody tried this or had any luck using this (or a similar) method?
... View more
09-20-2011
08:54 AM
|
0
|
2
|
729
|
POST
|
Looks like I got caught up in trying to figure out the error message, and forgot to change the spatial extent from a previous basemap I was using. (The basemap in my posted code was supposed to be on. I had turned it off temporarily trying to trouble shoot). Thanks to everyone for helping me figure out another rookie mistake.
... View more
08-24-2011
06:56 AM
|
0
|
0
|
306
|
POST
|
Sorry I can't be more specific in the title. The other day, 2 of my JavaScript maps stopped working properly while a third kept working. The only thing the two that stopped working have in common is that they contain dojo elements. I brought up Firebug, and received this error when trying to load: TypeError: Unable to draw graphic (geometry:null, symbol:null): this._gc is null [Break On This Error] if(!dojo._hasResource["dijit._base.man...h","tr","xx","zh","zh-cn","zh-tw"]); arcgis?v=2.4 (line 48) Line 48 in my code is CSS- in ESRI's JavaScript document, at http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.4, it contains information about Dojo. Is this a known error, or did I screw something else up? Changing to version 2.3 through 2.1 did not fix my problem, either.
... View more
08-22-2011
12:47 PM
|
0
|
6
|
632
|
POST
|
I think this is an error in the api . If you switch to v2.4 it works crossbrowser You're right- I switched to 2.4 from 2.3 and I now don't have to move the map. Thanks for the tip- hopefully that works for the rest of you.
... View more
08-10-2011
07:50 AM
|
0
|
0
|
466
|
POST
|
I opened the map in chrome. Clicking on the poly's pops open the popup, no map moving ever. ?? I'm wondering if this is a browser compatibility issue, then. I'm using Firefox 3.6.13 at work, I'll try the current version of Firefox 4 tomorrow. To everyone else with a problem, what browser are you using? I don't think the popups worked with our version of IE, either.
... View more
08-09-2011
10:39 AM
|
0
|
0
|
466
|
POST
|
Derek, here's a copy of the map I'm working on that has the problem. http://arcviewdev.uww.edu/javamap.html (And before anyone says anything, yes, I'm aware of the errors with my data. They've been fixed on a more recent version) Hopefully that will help.
... View more
08-09-2011
09:38 AM
|
0
|
0
|
466
|
POST
|
I didn't have any luck with the code you posted. I'm not sure what's going on, since all of ESRI's sample maps work fine with the infowindows. I was able to get the tooltip function to work, though, which works for what I need it to do without moving the map. Thank you for the replies.
... View more
08-03-2011
06:27 AM
|
0
|
0
|
569
|
POST
|
Yes, by dojo popup I mean the widget, which runs off dojo. It's hard to keep terms straight when I have to keep switching APIs by project. Here's the code I have for just the map layers and the info windows. When it's done loading, clicking on the map shows nothing. As soon as it's moved just a pixel, the info windows show up.
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.layers.FeatureLayer");
var map;
var campus;
function init() {
map = new esri.Map("mapDiv",{extent:startExtent });
var spatialRef = new esri.SpatialReference({wkid:102100});
var startExtent = new esri.geometry.Extent();
startExtent.xmin = -9879338;
startExtent.ymin = 5286787;
startExtent.xmax = -9878257;
startExtent.ymax = 5287623;
startExtent.SpatialReference = spatialRef;
map.setExtent(startExtent);
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("SERVICE NAME");
map.addLayer(basemap);
//Popup code for campus building layer
var contenta = "<b>Building Type</b>: ${Type}" +
"<br /><b>Hours</b>: ${Hours}" +
"<br /><input type='hidden' id='url' value=${FloorPlan}></input>" + // KEEP THIS LINE ON- NEEDED FOR loadUrl FUNCTION
"<br /><button onclick=revealModal('modalPage') value='test' />Floor Plan</button>";
var bldginfo = new esri.InfoTemplate("${BldgName}", contenta);
campus = new esri.layers.FeatureLayer("SERVICE NAME", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
infoTemplate: bldginfo
});
map.addLayer(campus);
//Popup code for parking lot layer
var contentb = "<b>Parking Lot</b>: ${LotNo} ${Commuter}" +
"<br />This lot ${Meters} have parking meters.";
var parkinfo = new esri.InfoTemplate("Parking Lot Information", contentb);
parking = new esri.layers.FeatureLayer("SERVICE NAME", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outfields: ["*"],
infoTemplate: parkinfo
});
map.addLayer(parking);
}
... View more
07-25-2011
07:23 AM
|
0
|
0
|
569
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|