POST
|
I have tried several ways to connect to a URL in the info window. In the feature layer I have an attribute field with the URL for each of the features in that layer. The url's ar individual for each feature. I have tried to work out the example code of the "Format InfoWindow Contents", http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm, with no luck. Is there anyone who can help me with this? function initOperationalLayer(map) {
var content = "<b>Kommun</b>: ${KOMMUN}" +
"<br /><b>Hemsida</b>: ${URL}";
var infoTemplate = new esri.InfoTemplate("Kommun_Centrum", content);
var featureLayer = new esri.layers.FeatureLayer("http://localhost/ArcGIS/rest/services/Bredband/KommunCenter/MapServer/0",{
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
infoTemplate: infoTemplate
});
map.addLayer(featureLayer);
map.infoWindow.resize(200,105);
mapLayers.push(featureLayer);
}
... View more
02-15-2011
12:26 AM
|
0
|
0
|
474
|
POST
|
How do I turn of the tool tip for the add graphic? The one that says "Click to start drawing". I don´t want this text box and the other two following this one to show when my users start drawing.
... View more
02-15-2011
12:18 AM
|
0
|
3
|
494
|
POST
|
Add the following as the first argument in the onclick events for your navigation tools. As soon as the other tools are clicked it will deactivate the measuring tool. tb.deactivate(); You'll want to add another tool to your bar that is the opposite so that the user can reactivate the measuring tool, i.e. tb.activate(); In my apps I always include a "pointer" tool that onclick deactivates all tools. You could just as easily write it in-line in the onclick event, buy I like to keep my javascript seperate from my html.
function deactAllTools() {
navToolbar.deactivate();
drawToolbar.deactivate();
}
<div dojoType="dijit.form.Button" id="zoomin" iconClass="zoominIcon" onClick="tb.deactivate();navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN);">Zooma in</div>
<div dojoType="dijit.form.Button" id="zoomout" iconClass="zoomoutIcon" onClick="tb.deactivate();navToolbar.activate(esri.toolbars.Navigation.ZOOM_OUT);">Zooma ut</div>
<div dojoType="dijit.form.Button" id="zoomfullext" iconClass="zoomfullextIcon" onClick="tb.deactivate();navToolbar.zoomToFullExtent();">Full utbredning</div>
<div dojoType="dijit.form.Button" id="pan" iconClass="panIcon" onClick="tb.deactivate();navToolbar.activate(esri.toolbars.Navigation.PAN);">Panorera</div> Thanks for your answer. Unfortunatly this does not work. I have put the argument tb.Deactivate to the onclick event. I get an error saying tb is undefined. What am I doing wrong? How do I use the function deactAllTools? I'm new to JavaScripting.
... View more
02-14-2011
05:54 AM
|
0
|
0
|
558
|
POST
|
I'm making a simple web application using the JavaScript API. In this web app I want to be able to info-click a point layer, navigate in the map, use the zoom slider and measure a distance and the calculate the cost of this distans. I've manage to get all of this tools into my web app but the problem is that the measure "tool" does not deactivate when using the tools in the navigation toolbar. Does any one know how I can connect the measure tool to a button so I can chose when to activate and deactivate it? I enclose my script below: <!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=utf8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Bredband</title>
<style type="text/css">
@import "http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css";
.zoominIcon { background-image:url(images/nav_zoomin.png); width:16px; height:16px; }
.zoomoutIcon { background-image:url(images/nav_zoomout.png); width:16px; height:16px; }
.zoomfullextIcon { background-image:url(images/nav_fullextent.png); width:16px; height:16px; }
.panIcon { background-image:url(images/nav_pan.png); width:16px; height:16px; }
</style>
<script type="text/javascript">djConfig = { parseOnLoad:true }</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.toolbars.navigation");
dojo.require("dijit.form.Button");
dojo.require("dijit.Toolbar");
dojo.require("esri.layers.FeatureLayer");
dojo.require("dijit.Dialog");
dojo.require("esri.tasks.geometry");
dojo.require("esri.toolbars.draw");
dojo.require("dojo.number");
var mapLayers = [];
var map, navToolbar;
var geometryService;
function init() {
var initExtent = new esri.geometry.Extent({
"xmin": 1292063,
"ymin": 6136810,
"xmax": 1424193,
"ymax": 6268575,
"spatialReference": {
"wkid": 2400
}
});
map = new esri.Map("map", {
extent: initExtent
});
dojo.connect(map, "onLoad", initOperationalLayer);
dojo.connect(map, "onLoad", initFunctionality);
var imagery = new esri.layers.ArcGISTiledMapServiceLayer("http://localhost/ArcGIS/rest/services/Bredband/Kommuner/MapServer");
map.addLayer(imagery);
mapLayers.push(imagery);
geometryService = new esri.tasks.GeometryService("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
dojo.connect(geometryService, "onLengthsComplete", outputDistance);
navToolbar = new esri.toolbars.Navigation(map);
}
//function init() {
// esriConfig.defaults.map.sliderLabel = null;
//var startExtent = new esri.geometry.Extent({"xmin":1226897.18243243,"ymin":6130221.75,"xmax":1489358.81756757,"ymax":6275163.25,"spatialReference":{"wkid":2400}});
//map = new esri.Map("map",{extent:startExtent});
//map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer("http://localhost/ArcGIS/rest/services/Bredband/Kommuner/MapServer"));
//navToolbar = new esri.toolbars.Navigation(map);
//}
function initOperationalLayer(map) {
var content = "<b>Kommun</b>: ${KOMMUN}" +
"<br /><b>Hemsida</b>: ${URL}";
var infoTemplate = new esri.InfoTemplate("Kommun_Centrum", content);
var featureLayer = new esri.layers.FeatureLayer("http://localhost/ArcGIS/rest/services/Bredband/KommunCenter/MapServer/0",{
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
outFields: ["*"],
infoTemplate: infoTemplate
});
map.addLayer(featureLayer);
map.infoWindow.resize(200,105);
mapLayers.push(featureLayer); //this client side map layer is the maps graphics layer
}
function initFunctionality(map) {
var tb = new esri.toolbars.Draw(map);
var lengthParams = new esri.tasks.LengthsParameters();
//on draw end add graphic, project it, and get new length
dojo.connect(tb, "onDrawEnd", function(geometry) {
map.graphics.clear();
lengthParams.polylines = [geometry];
lengthParams.lengthUnit = esri.tasks.GeometryService.UNIT_METER;
lengthParams.geodesic = true;
geometryService.lengths(lengthParams);
var graphic = map.graphics.add(new esri.Graphic(geometry, new esri.symbol.SimpleLineSymbol()));
});
tb.activate(esri.toolbars.Draw.FREEHAND_POLYLINE);
}
function outputDistance(result) {
dojo.byId("distance").innerHTML = dojo.number.format(result.lengths[0] / 1000 * 4.8) + " kronor";
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<div id="navToolbar" dojoType="dijit.Toolbar">
<div dojoType="dijit.form.Button" id="zoomin" iconClass="zoominIcon" onClick="navToolbar.activate(esri.toolbars.Navigation.ZOOM_IN);">Zooma in</div>
<div dojoType="dijit.form.Button" id="zoomout" iconClass="zoomoutIcon" onClick="navToolbar.activate(esri.toolbars.Navigation.ZOOM_OUT);">Zooma ut</div>
<div dojoType="dijit.form.Button" id="zoomfullext" iconClass="zoomfullextIcon" onClick="navToolbar.zoomToFullExtent();">Full utbredning</div>
<div dojoType="dijit.form.Button" id="pan" iconClass="panIcon" onClick="navToolbar.activate(esri.toolbars.Navigation.PAN);">Panorera</div>
</div>
<div id="map" style="width:1024px; height:512px; border:1px solid #000;"></div>
Kostnad: <span id="distance"></span>
</body>
</html>
... View more
02-13-2011
09:54 AM
|
0
|
6
|
1197
|
POST
|
I solved the problem. Apparently there wasn't a coordinate system defined for the cad file and there for it didn't show.
... View more
10-29-2010
01:35 AM
|
0
|
0
|
230
|
POST
|
Is it possible to view CAD data in ArcGIS Explorer? I have tried to save the dwg data as a layer file but when adding it to ArcGIS Explorer the data does not show.
... View more
10-29-2010
01:04 AM
|
0
|
3
|
3409
|
POST
|
I'm wondering if it is possibel to use OpenStreetMap in ArcGIS Viewer for Flex? If it is how do I edit the config.xml to get the OpenStreetmap to show in my viewer? ___________________ Annika Hermodsson Hyltén WSP Sverige AB GIS-analyst
... View more
10-08-2010
01:23 AM
|
0
|
10
|
3057
|
POST
|
I am doing a OD Cost Matrix between several areas in two cities. The lines that the OD Cost matrix presents are drawn on top of each other since the cities are rather close together. I want to use these generalised lines is there some way that I can separate the lines. What I would like to do is to make them bend out from their original position. Annika
... View more
06-29-2010
04:18 AM
|
0
|
0
|
1611
|
Online Status |
Offline
|
Date Last Visited |
Tuesday
|