|
POST
|
I have a popup/infowindow that returns info for 2 of the layers in my map. However, when I click anywhere in the map the popup also comes up that says "no information available". Is there a way to disable this so that the popup only appears when a feature is clicked?
... View more
09-20-2012
04:29 AM
|
0
|
3
|
1166
|
|
POST
|
Hope this helps. legendLayers.push({layer:layer,title:'YOUR TITLE'});
... View more
09-17-2012
06:04 AM
|
0
|
0
|
1801
|
|
POST
|
Something similar to: http://localgovtemplates2.esri.com/electionpollingplace/
... View more
09-07-2012
09:30 AM
|
0
|
0
|
1426
|
|
POST
|
I don't think I'm explaining what I am trying to do very well. Essentially I want to completely replace the gray boxes (and arrows) so that when you click on the custom image it opens the panes. I'm trying to copy what is done in a majority of the local government apps and put icons in the place of the gray buttons. I've tried converting to a dijit.form.ToggleButton but couldn't get it to work.
... View more
09-07-2012
09:04 AM
|
0
|
0
|
1426
|
|
POST
|
thanks for your response. The ultimate goal is to replace those gray buttons completely with other images. I have 4 titlepanes which I would like to have different icons (basemap gallery, search, legend, layers).
... View more
09-07-2012
07:43 AM
|
0
|
0
|
1426
|
|
POST
|
Is it possible to have a custom image icon in a TitlePane, instead of the generic gray dropdown box? <div dojoType="dijit.TitlePane" title="Switch Basemap" closable="false" open="false" src="basemap.png" style="float:right; margin-right:10px;">
<div dojoType="dijit.layout.ContentPane" style="width:380px; height:280px; overflow:auto;">
<div id="basemapGallery" >
</div></div>
</div> I've tried adding something like src="image.png"
... View more
09-07-2012
07:13 AM
|
0
|
10
|
4614
|
|
POST
|
I started with this sample and modified it to meet my needs. It sounds like what you are trying to do.
... View more
09-06-2012
07:09 AM
|
0
|
0
|
667
|
|
POST
|
Thanks for your reply, as far as I can tell from your fiddle, our codes are pretty similar. I don't have an initial basemap set specifically, it just defaults to the aerial. Other than that, I am just loading the Dynamic layer. The weird thing is that I have refreshed my map a few times and probably 1 out of every 10 times it loads and functions correctly. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>
</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.0/js/dojo/dijit/themes/claro/claro.css">
<style type="text/css">
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
.esriBasemapGallerySelectedNode .esriBasemapGalleryThumbnail{
border-color: #66FFFF !important;
}
#header {
padding-top:5px;
padding-left:10px;
background-color:cornflowerblue; color:navy; font-size:18pt;
text-align:left; font-weight:bold;
height:30px;
}
#map{
padding:0;
}
</style>
<script type="text/javascript">
var djConfig = {
parseOnLoad: true
};
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.0"></script>
<script type="text/javascript">
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("dijit.TitlePane");
dojo.require("esri.dijit.BasemapGallery");
dojo.require("esri.arcgis.utils");
dojo.require("esri.tasks.locator");
var map, locator, layer, visible = [];
function init() {
var initExtent = new esri.geometry.Extent({"xmin":-9265357.374781793,
"ymin":3337183.1320917513,
"xmax":-9021064.632382275,
"ymax":3476757.145740537,
"spatialReference":{"wkid":102100}});
map = new esri.Map("map", {extent:initExtent, logo:false});
createBasemapGallery();
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
locator = new esri.tasks.Locator("http://tasks.arcgis.com/ArcGIS/rest/services/WorldLocator/GeocodeServer");
dojo.connect(locator, "onAddressToLocationsComplete", showResults);
map.infoWindow.resize(200,125);
layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://gisprod2/arcgis/rest/services/Dynamic/CountyTest/MapServer");
if (layer.loaded) {
buildLayerList(layer);
}
else {
dojo.connect(layer, "onLoad", buildLayerList);
}
}
function buildLayerList(layer) {
var items = dojo.map(layer.layerInfos,function(info,index){
if (info.defaultVisibility) {
visible.push(info.id);
}
return "<input type='checkbox' class='list_item'" + (info.defaultVisibility ? "checked=checked" : "") + "' id='" + info.id + "' onclick='updateLayerVisibility();' /><label for='" + info.id + "'>" + info.name + "</label>";
});
dojo.byId("layer_list").innerHTML = items.join(' ');
layer.setVisibleLayers(visible);
map.addLayer(layer);
}
function updateLayerVisibility() {
var inputs = dojo.query(".list_item"), input;
visible = [];
dojo.forEach(inputs,function(input){
if (input.checked) {
visible.push(input.id);
}
});
//if there aren't any layers visible set the array to be -1
if(visible.length === 0){
visible.push(-1);
}
layer.setVisibleLayers(visible);
}
function locate() {
map.graphics.clear();
var address = {"SingleLine":dojo.byId("address").value};
locator.outSpatialReference= map.spatialReference;
var options = {
address:address,
outFields:["Loc_name"]
}
locator.addressToLocations(options);
}
function showResults(candidates) {
var candidate;
var symbol = new esri.symbol.SimpleMarkerSymbol();
var infoTemplate = new esri.InfoTemplate("Location", "Address: ${address}<br />Score: ${score}<br />Source locator: ${locatorName}");
symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_ROUND);
symbol.setColor(new dojo.Color([153,0,51,0.75]));
var geom;
dojo.every(candidates,function(candidate){
console.log(candidate.score);
if (candidate.score > 80) {
console.log(candidate.location);
var attributes = { address: candidate.address, score:candidate.score, locatorName:candidate.attributes.Loc_name };
geom = candidate.location;
var graphic = new esri.Graphic(geom, symbol, attributes, infoTemplate);
//add a graphic to the map at the geocoded location
map.graphics.add(graphic);
//add a text symbol to the map listing the location of the matched address.
var displayText = candidate.address;
var font = new esri.symbol.Font("16pt",esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL,esri.symbol.Font.WEIGHT_BOLD,"Helvetica");
var textSymbol = new esri.symbol.TextSymbol(displayText,font,new dojo.Color("#666633"));
textSymbol.setOffset(0,8);
map.graphics.add(new esri.Graphic(geom, textSymbol));
return false; //break out of loop after one candidate with score greater than 80 is found.
}
});
if(geom !== undefined){
map.centerAndZoom(geom,15);
}
}
function createBasemapGallery() {
var basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: true,
map: map
}, "basemapGallery");
var selectionHandler = dojo.connect(basemapGallery,"onSelectionChange",function(){
dojo.disconnect(selectionHandler);
});
basemapGallery.startup();
dojo.connect(basemapGallery, "onError", function(msg) {console.log(msg)});
}
//show map on load
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width:100%;height:100%;margin:0;">
<div id="header" class="roundedCorners" dojotype="dijit.layout.ContentPane" region="top" align="left">
Marion County Template
<div style="position:absolute; right:160px; top:10px; z-Index:99;">
<div id="locate"></div> </div>
</div>
<!--Basemap-->
<div id="map" dojotype="dijit.layout.ContentPane" region="center" style="border:1px solid #000;">
<div style="position:absolute; right:20px; top:10px; z-Index:98;">
<div dojoType="dijit.TitlePane" title="Search" closable="false" open="false" style="float:right">
<b><i>Search by Address:</i></b>
<br />
<textarea type="text" id="address"/>601 SE 25th Ave, Ocala, FL 34471</textArea>
<br />
<button dojotype="dijit.form.Button" onclick="locate()">Search</button>
</div>
<div dojoType="dijit.TitlePane" title="Layers" closable="false" open="false" style="float:right; margin-right:10px;">
<span id="layer_list"><input type='checkbox' class='list_item' id='0' value=0 onclick='updateLayerVisibility();'
</span>
</div>
<div dojoType="dijit.TitlePane" title="Switch Basemap" closable="false" open="false" style="float:right; margin-right:10px;">
<div dojoType="dijit.layout.ContentPane" style="width:380px; height:280px; overflow:auto;">
<div id="basemapGallery" >
</div></div>
</div>
</div>
</div>
</div>
</body>
</html>
... View more
08-27-2012
10:37 AM
|
0
|
0
|
833
|
|
POST
|
I have added code from the Dynamically Create Layer List sample to my app. It works as expected, except, it loads without my basemap. I have a switch basemap dropdown that still populates with all the ESRI basemaps, however, they don't load when clicked. When I do click on one, it eliminates my DynamicMapServiceLayer. I added the following in the init(): layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://gisprod2/arcgis/rest/services/Dynamic/CountyTest/MapServer"); if (layer.loaded) { buildLayerList(layer); } else { dojo.connect(layer, "onLoad", buildLayerList); } and then separate functions of: function buildLayerList(layer) { var items = dojo.map(layer.layerInfos,function(info,index){ if (info.defaultVisibility) { visible.push(info.id); } return "<input type='checkbox' class='list_item'" + (info.defaultVisibility ? "checked=checked" : "") + "' id='" + info.id + "' onclick='updateLayerVisibility();' /><label for='" + info.id + "'>" + info.name + "</label>"; }); dojo.byId("layer_list").innerHTML = items.join(' '); layer.setVisibleLayers(visible); map.addLayer(layer); } function updateLayerVisibility() { var inputs = dojo.query(".list_item"), input; visible = []; dojo.forEach(inputs,function(input){ if (input.checked) { visible.push(input.id); } }); //if there aren't any layers visible set the array to be -1 if(visible.length === 0){ visible.push(-1); } layer.setVisibleLayers(visible); } I get the following error in Chrome Developer Tools when I try to switch basemap 1. Resource interpreted as Script but transferred with MIME type tex/plain: "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer Any ideas why the basemaps will not load initially or switch?
... View more
08-27-2012
07:24 AM
|
0
|
4
|
1093
|
|
POST
|
Hmm. Well I guess my problems are a bit more complicated than I thought. My map works in Chrome, but in IE or Firefox it fails, even with the changes your indicated.
... View more
08-24-2012
08:03 AM
|
0
|
0
|
451
|
|
POST
|
I have two drop down menus: 1 for a search function and 1 to open up a basemap gallery. I would like them both to be in either the header or the main content pane. However, when I put them in the same div id the map doesn't draw. The map draws as the code is written now and the drop boxes function as expected, however, the search function is placed in a very small (16px high) window area. This may be more of a HTML or CSS question, but I can't seem to locate the error in why both can't be placed in the same area of the page? <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>
</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.0/js/dojo/dijit/themes/claro/claro.css" />
<style type="text/css">
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
.esriBasemapGallerySelectedNode .esriBasemapGalleryThumbnail{
border-color: #66FFFF !important;
}
#header {
padding-top:5px;
padding-left:10px;
background-color:darkgreen; color:white; font-size:18pt;
text-align:left; font-weight:bold;
height:40px;
}
#map{
padding:0;
}
</style>
<script type="text/javascript">
var djConfig = {
parseonload: true
};
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.0"></script>
<script type="text/javascript">
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("dijit.TitlePane");
dojo.require("esri.dijit.BasemapGallery");
dojo.require("esri.arcgis.utils");
dojo.require("esri.tasks.locator");
var map, locator;
function init() {
var initExtent = new esri.geometry.Extent({"xmin":-9265357.374781793,
"ymin":3337183.1320917513,
"xmax":-9021064.632382275,
"ymax":3476757.145740537,
"spatialReference":{"wkid":102100}});
map = new esri.Map("map",{extent:initExtent});
createBasemapGallery();
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
locator = new esri.tasks.Locator("http://tasks.arcgis.com/ArcGIS/rest/services/WorldLocator/GeocodeServer");
dojo.connect(locator, "onAddressToLocationsComplete", showResults);
map.infowindow.resize(200,125);
}
function locate() {
map.graphics.clear();
var address = {"SingleLine":dojo.byId("address").value};
locator.outSpatialReference= map.spatialReference;
var options = {
address:address,
outFields:["Loc_name"]
}
locator.addressToLocations(options);
}
function showResults(candidates) {
var candidate;
var symbol = new esri.symbol.SimpleMarkerSymbol();
var infoTemplate = new esri.InfoTemplate("Location", "Address: ${address}<br />Score: ${score}<br />Source locator: ${locatorName}");
symbol.setStyle(esri.symbol.SimpleMarkerSymbol.STYLE_ROUND);
symbol.setColor(new dojo.Color([153,0,51,0.75]));
var geom;
dojo.every(candidates,function(candidate){
console.log(candidate.score);
if (candidate.score > 80) {
console.log(candidate.location);
var attributes = { address: candidate.address, score:candidate.score, locatorName:candidate.attributes.Loc_name };
geom = candidate.location;
var graphic = new esri.Graphic(geom, symbol, attributes, infoTemplate);
//add a graphic to the map at the geocoded location
map.graphics.add(graphic);
//add a text symbol to the map listing the location of the matched address.
var displayText = candidate.address;
var font = new esri.symbol.Font("16pt",esri.symbol.Font.STYLE_NORMAL, esri.symbol.Font.VARIANT_NORMAL,esri.symbol.Font.WEIGHT_BOLD,"Helvetica");
var textSymbol = new esri.symbol.TextSymbol(displayText,font,new dojo.Color("#666633"));
textSymbol.setOffset(0,8);
map.graphics.add(new esri.Graphic(geom, textSymbol));
return false; //break out of loop after one candidate with score greater than 80 is found.
}
});
if(geom !== undefined){
map.centerAndZoom(geom,15);
}
}
function createBasemapGallery() {
var basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: true,
map: map
}, "basemapGallery");
var selectionHandler = dojo.connect(basemapGallery,"onselectionchange",function(){
dojo.disconnect(selectionHandler);
//add the operational layers to the map
var operationalLayer = new esri.layers.ArcGISDynamicMapServiceLayer("http://<myserver>/arcgis/rest/services/Dynamic/Parks/MapServer", {"opacity":1});
map.addLayer(operationalLayer);
});
basemapGallery.startup();
dojo.connect(basemapGallery, "onerror", function(msg) {console.log(msg)});
}
//show map on load
dojo.addonload(init);
</script>
</head>
<body class="claro">
<div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width:100%;height:100%;margin:0;">
<div id="header" class="roundedCorners" dojotype="dijit.layout.ContentPane" region="top" align="left">
Template
</div>
<!--Search Function-->
<div id="top" class="roundedCorners" dojotype="dijit.layout.ContentPane" region="top" align="right">
<div style="position:absolute; right:160px; top:10px;">
<div dojoType="dijit.TitlePane" title="Search" closable="false" open="false">
<b><i> Search by Address:</i></b>
<br />
<textarea type="text" id="address">Enter Address</textArea>
<br />
<button dojotype="dijit.form.Button" onclick="locate()">Search</button>
</div>
<div id="locate"></div>
</div>
</div>
<!--Layer Toggle-->
<!--Basemap-->
<div id="map" dojotype="dijit.layout.ContentPane" region="center" style="border:1px solid #000;">
<div style="position:absolute; right:20px; top:10px; z-Index:98;">
<div dojoType="dijit.TitlePane" title="Switch Basemap" closable="false" open="false">
<div dojoType="dijit.layout.ContentPane" style="width:380px; height:280px; overflow:auto;">
<div id="basemapGallery"></div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
... View more
08-24-2012
07:12 AM
|
0
|
2
|
708
|
|
POST
|
Well the code I inserted does not seem to run. I placed it at the end just before }
dojo.addOnLoad(Init);
... View more
08-17-2012
04:25 AM
|
0
|
0
|
1241
|
|
POST
|
I've set it to: var app = {};
app.printUrl = "http://gisprod2/arcgis/rest/services/Utilities/PrintingTools/GPServer/Export%20Web%20Map%20Task";
... View more
08-16-2012
12:22 PM
|
0
|
0
|
1341
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-16-2014 09:52 AM | |
| 6 | 06-12-2013 08:01 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|