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
|
469
|
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
|
825
|
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
|
385
|
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
|
329
|
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
|
219
|
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
|
867
|
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
|
438
|
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
|
808
|
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
|
1262
|
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
|
694
|
POST
|
You can use the esri.arcgis.utils.createMap method to add an item from ArcGIS.com to your application. This method requires the web map id from ArcGIS.com. There are a few samples in the help that show how to work with items from ArcGIS.com http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples_start.htm#jssamples/ags_fullmaplayout.html
... View more
02-03-2011
07:31 AM
|
0
|
0
|
341
|
POST
|
Most of the API's functionality should work well on Android. You can test this out by navigating to the help site on your Android device. If you go to http://links.esri.com/javascript from a mobile device you'll see a mobile version of the samples page so you can test the samples out on your device.
... View more
02-03-2011
07:26 AM
|
0
|
0
|
238
|
POST
|
The identify task allows you to specify a tolerance but the query task does not. http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jsapi_start.htm#jsapi/identifytask.htm If you want to use the query task to query points you'll have to generate a tolerance. This blog post has some sample code that does this: http://blogs.esri.com/Dev/blogs/arcgisserver/archive/2009/01/15/Querying-points-and-lines-on-click-with-the-ArcGIS-JavaScript-API.aspx
... View more
02-01-2011
05:08 PM
|
0
|
0
|
198
|
POST
|
It looks like there may be some issues displaying VML after applying the security update. Here's a forum thread from Internet Explorer Tech Center regarding this issue: http://social.technet.microsoft.com/Forums/en/ieitpropriorver/thread/f3cf7105-fa1b-40ed-8462-111d86757092 If you are using McAfee virus software see here for information: https://kc.mcafee.com/corporate/index?elq_mid=4718&elq_cid=372908&page=content&id=KB70810
... View more
01-18-2011
08:04 AM
|
0
|
0
|
294
|
POST
|
Here are a few links that might help. This info is from the rest doc: http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/mapserver.html#response Support for time-aware map services was added at 10. If the map supports quering and exporting maps based on time, the response will include a timeInfo property which includes information such as the map's time extent and the map's native time reference. However, note that the REST API always encodes time in UTC (milliseconds from epoch). We also have some information on working with time in the JS API 'Working with time-aware layers' help doc: http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jshelp_start.htm#jshelp/inside_temporal.htm
... View more
01-14-2011
06:08 AM
|
0
|
0
|
1840
|
Title | Kudos | Posted |
---|---|---|
2 | yesterday | |
1 | 01-17-2025 11:55 AM | |
2 | 01-15-2025 02:08 PM | |
1 | 12-30-2024 02:15 PM | |
1 | 01-19-2022 08:59 AM |
Online Status |
Offline
|
Date Last Visited |
yesterday
|