POST
|
If the only thing you are using is the template picker to create features then you may want to take a look at the Editing without Editor sample. This sample shows how to use the template picker to add features and does not display the attribute inspector: I am not using the editor toolbar, but I am using the template picker. I'm using it to create new features and to edit feature attributes. However, most of the attributes are all housed in related business tables so I'm using a lot of custom code. .
... View more
03-25-2011
01:07 PM
|
0
|
0
|
374
|
POST
|
Although scrollWheelZoom should be enabled by default so perhaps there is something else going on in your case. If you run one of the samples can you use your mouse scrolling to zoom?
... View more
03-25-2011
01:05 PM
|
0
|
0
|
675
|
POST
|
That was my original code. That doesn't work either. You have to wait until the map is loaded for this to work, are you doing something like this?
dojo.connect(map, "onLoad", function() {
map.enableScrollWheelZoom();
});
... View more
03-25-2011
01:03 PM
|
0
|
0
|
675
|
POST
|
enableScrollWheelZoom isn't set via the Map's constructor. Try this after the map is created. map.enableScrollWheelZoom(); You can find more details about map navigation here: http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/intro_navigation.htm FWIW, I wonder if this is a related issue - I can't get my map to enable zooming with the scroll wheel either. It appears that my map settings are having no effect whatsoever.
map = new esri.Map("map", {
enableScrollWheelZoom: true,
showInfoWindowOnClick:false
});
Any ideas as to why these settings are not being honored?
... View more
03-25-2011
12:59 PM
|
0
|
0
|
675
|
POST
|
I re-read your initial post and this is because you are using the editor. The editor uses the info window to display attribute information. Can you tell me a bit about how you are using the editor, for example are you using it just to create new features - or are you using the toolbar etc? Thanks Kelly! I appreciate the tip. Unfortunately it didn't work. I added that to my init() function but the infoWindow still pops up.
... View more
03-25-2011
12:54 PM
|
0
|
0
|
675
|
POST
|
We are working on adding a sample that shows how to use these, in the meantime the following code snippets might help: GeodesicLengths: map.graphics.add(new esri.Graphic(geometry, graphicSymbol));
//Since the map projection is web mercator, convert to lat/lon
var geographicGeometry = geometry;
//calculate geodesic length on client
var lengths = esri.geometry.geodesicLengths([geographicGeometry], esri.Units.KILOMETERS); Geodesic Areas: map.graphics.add(new esri.Graphic(geometry, graphicSymbol));
var geographicGeometries = [];
//if self intersecting, simplify using geometry service
if (esri.geometry.polygonSelfIntersecting(geometry)) {
//if self intersecting, simplify using geometry service
geometryService.simplify([geometry], function(simplifiedGeometries) {
dojo.forEach(simplifiedGeometries, function(simplifiedGeometry, idx) {
geographicGeometries.push(esri.geometry.webMercatorToGeographic(simplifiedGeometry));
});
var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES);
dojo.byId("result").innerHTML = "The area of the polygon is: " + areas[0] + " Acres";
});
}
else {
geographicGeometries.push(esri.geometry.webMercatorToGeographic(geometry));
var areas = esri.geometry.geodesicAreas(geographicGeometries, esri.Units.ACRES);
dojo.byId("result").innerHTML = "The area of the polygon is: " + areas[0] + " Acres";
}
}
... View more
03-25-2011
12:47 PM
|
0
|
0
|
418
|
POST
|
When you create the map set the showInfoWindowOnClick option to false to disable the info window. Here's a code snippet that shows this:
map = new esri.Map("map", {
extent: esri.geometry.geographicToWebMercator(new esri.geometry.Extent(-125.90, 44.60, -114.65, 50.22, new esri.SpatialReference({wkid:4326}))),
showInfoWindowOnClick:false
});
... View more
03-25-2011
12:37 PM
|
0
|
0
|
675
|
POST
|
Sara, If you are trying to display info windows for one layer in your map an easier solution might be to create a feature layer. When you create a new feature layer and add it to the map you can define an info template for that layer. Then when someone clicks on a feature in that layer the info window appears. Here's an example showing how this works:
<!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" />
<!--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>
Street Trees
</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.2/js/dojo/dijit/themes/claro/claro.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
.esriScalebar{padding: 20px 20px; }
#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=2.2">
</script>
<script type="text/javascript">
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.map");
dojo.require("esri.dijit.Scalebar");
dojo.require("esri.layers.FeatureLayer");
var map;
function init() {
var initExtent = new esri.geometry.Extent({
"xmin": -13627755,
"ymin": 4548254,
"xmax": -13626718,
"ymax": 4548849,
"spatialReference": {
"wkid": 102100
}
});
map = new esri.Map("map", {
extent: initExtent
});
//Add the topographic layer to the map. View the ArcGIS Online site for services http://arcgisonline/home/search.html?t=content&f=typekeywords:service
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer");
map.addLayer(basemap);
var template = new esri.InfoTemplate();
template.setTitle("<b>${qAddress}</b>");
template.setContent("${*}");
//add the street trees to the map
var featureLayer = new esri.layers.FeatureLayer("http://servicesbeta.esri.com/ArcGIS/rest/services/SanFrancisco/SFStreetTreesRendered/MapServer/0", {
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
infoTemplate:template,
outFields: ["*"]
});
map.addLayer(featureLayer);
var resizeTimer;
dojo.connect(map, 'onLoad', function(theMap) {
var scalebar = new esri.dijit.Scalebar({
map: map,
attachTo: "top-right"
});
dojo.connect(dijit.byId('map'), 'resize', function() { //resize the map if the div is resized
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
map.resize();
map.reposition();
}, 500);
});
});
}
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="map" dojotype="dijit.layout.ContentPane" region="center" style="overflow:hidden;">
</div>
</div>
</body>
</html>
... View more
03-25-2011
08:24 AM
|
0
|
0
|
335
|
POST
|
At 2.1, getContent returned attributes as key/value pairs at 2.2, we didn't document this usage but we did use it in a few samples. At 2.2, the recommended approach is to use esri.substitute to get the information, here's a snippet that shows how this works: esri.substitute(evt.graphic.attributes, "${*}") We use this in the Find Closest Facilities sample.
... View more
03-21-2011
01:11 PM
|
0
|
0
|
289
|
POST
|
If you click on the doh_sb375_corridor layer it will expand and you will see the sub-layer. I followed the instructions in the new blog post about configuring popups, here: http://blogs.esri.com/Support/blogs/arcgisonline/archive/2011/03/16/configuring-layer-pop-ups.aspx I added a layer to the map here: http://www.arcgis.com/home/webmap/viewer.html?webmap=f66a2f0b6fe54f1a95cde55c957aa11c There is no sublayer that I can open in the TOC to configure popups. What does this mean? Thanks.
... View more
03-17-2011
06:36 AM
|
0
|
0
|
187
|
POST
|
can you send me the link for downloading the 2.2 version ? You can find the download from the FAQ page in the ArcGIS API for JavaScript resource center: http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_faq.htm
... View more
03-16-2011
11:42 AM
|
0
|
0
|
752
|
POST
|
When the jQuery time slider changes you can create a new time extent and set that to be the map's time extent.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>ESRI Map and jQuery</title>
<link href="jquery.time.slider.css" rel="stylesheet" type="text/css" />
<script type="text/javascript">
var djConfig = { parseOnLoad: true };
</script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script src="jquery.time.slider.js" type="text/javascript"></script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1compact"></script>
<script type="text/javascript" language="Javascript">
dojo.require("esri.map");
dojo.require("esri.layers.FeatureLayer");
var map;
function init() {
var startExtent = new esri.geometry.Extent({"xmin":-18233316,"ymin":981737,"xmax":-8449376,"ymax":6852101,"spatialReference":{"wkid":102100}});
map = new esri.Map("map", {extent:startExtent});
dojo.connect(map, "onLoad", function () {
$(document).ready(jQueryReady);
});
var layers = [];
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
map.addLayer(basemap);
// feature layer
var featureLayer = new esri.layers.FeatureLayer("http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Earthquakes/EarthquakesFromLastSevenDays/MapServer/0", {
mode: esri.layers.FeatureLayer.MODE_SNAPSHOT,
outFields: [ "*" ]
});
featureLayer.setDefinitionExpression("magnitude > 2");
dojo.connect(map, "onLayersAddResult", initSlider);
map.addLayers([featureLayer]);
}
function jQueryReady() {
$('.timepick').change(function () {
if(map.timeExtent){
console.log('change');
var timespan = new esri.TimeExtent();
timespan.startTime = $('.timepick').timeslider('get');
map.setTimeExtent(timespan);
$('#chosen-time').text($('.timepick').timeslider('get').toString());}
}).timeslider({ value: '12:00' });
}
function initSlider(result) {
console.log('initSlider');
var timeExtent = new esri.TimeExtent();
var now = new Date();
timeExtent.endTime = now;
map.setTimeExtent(timeExtent);
}
dojo.addOnLoad(init);
</script>
</head>
<body >
<div id="map" style="width:1000px; height:600px; border:1px solid #000;"></div>
<span id="chosen-time"></span>
<label>Time slider span: <span class="timepick">5:00</span></label>
</body>
</html>
... View more
03-10-2011
06:30 AM
|
0
|
0
|
397
|
POST
|
Here's a snippet that shows how to access the layer properties- in order to access all the information you'll need to wait until the layer is loaded.
dojo.connect(operationalLayer,"onLoad",function(){
console.log(operationalLayer.version);
console.log(operationalLayer.layerInfos);
console.log(operationalLayer.layerInfos[0].name);
});
... View more
03-10-2011
05:27 AM
|
0
|
0
|
700
|
POST
|
Version 2.2 of the ArcGIS API for JavaScript was released yesterday. Check out the post on the ArcGIS Server blog for more details.
... View more
03-03-2011
05:53 AM
|
0
|
8
|
1147
|
POST
|
The following sample in the developer help shows how to use attribute information in a hyperlink: http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/fl_infowindow.html
... View more
02-10-2011
09:32 AM
|
0
|
0
|
595
|
Title | Kudos | Posted |
---|---|---|
1 | a week ago | |
2 | 2 weeks ago | |
1 | 04-09-2024 02:37 PM | |
3 | 08-30-2024 09:20 AM | |
1 | 08-21-2024 02:33 PM |
Online Status |
Offline
|
Date Last Visited |
a week ago
|