|
POST
|
I think the problem might be that you're trying to get the extent of a point. Take a look at this thread for one way to do your zoom.
... View more
08-29-2013
12:05 PM
|
0
|
0
|
1001
|
|
POST
|
I agree this is going to be a bumpy transition. I have several projects written a couple years ago, it's not like I have the time to go back and rewrite everything I've done in the past. I think there should be samples in both styles, so we can see the before and after and get the hang of the differences . That API reference is good about showing both, but the samples are a mixed bag. I'd hate to see every sample move to AMD because I need to see both to know where and how to change my older code. This is one reason why I wish the Esri would keep the older versions of the samples and documentation on their website, similar to what Dojo does. With Dojo's documentation, you can select which version to see. However, when Esri redesigned their website, there doesn't seem to be a way of seeing the older versions (3.6 vs. 3.5 vs 3.4) of the help pages. It's kind of a pain to download the older SDKs and pick through the html files
... View more
08-29-2013
10:04 AM
|
0
|
0
|
2661
|
|
POST
|
Have you checked the values for layersToID to see if they're valid? For showing the infoWindow, try using map.infoWindow.show(evt.screenPoint, map.getInfoWindowAnchor(evt.screenPoint)); There is a difference between evt.screenPoint and evt.mapPoint
... View more
08-29-2013
05:21 AM
|
0
|
0
|
1990
|
|
POST
|
It probably will not run properly if you copy it to you computer and double click on it (meaning the browser shows the url something like file:///C:/Users/me/Desktop/index.html). You to set up a development environment. When developing with the ArcGIS API for JavaScript, a web server is required. This means that web pages and apps using the ArcGIS API for JavaScript need to be accessed over http:// (or https://) rather than file://. To meet this requirement, install and configure a web server. Web server software is available free of charge for all operating systems. For Windows, IIS is recommended. On Mac OS and Linux, Apache is a popular option but any web server will do. The important point is web pages using the ArcGIS API for JavaScript are served over http.
... View more
08-28-2013
11:50 AM
|
0
|
0
|
781
|
|
POST
|
What's happening is the alert fires before the layer is ready. You should run that function in the layer's load event or the map's layers-add-result event. require(["esri/map", "esri/geometry/Extent", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/ArcGISDynamicMapServiceLayer" ,"dojo/domReady!"], function(Map, Extent, ArcGISTiledMapServiceLayer,ArcGISDynamicMapServiceLayer,LayerInfo) { var map = new Map("map", {extent: new Extent({"xmin":506835.3785030904,"ymin":5439759.165184998,"xmax":515698.93789687584,"ymax":5450607.1035475405,"spatialReference":{"wkid":26910}}) }); var baseMap = new ArcGISTiledMapServiceLayer("http://cosmos.surrey.ca/COSREST/rest/services/Base_Map_All_Scales/MapServer"); allCityHighUse = new ArcGISDynamicMapServiceLayer("http://cosmosbeta.surrey.ca/COSREST/rest/services/Public/MapServer"); map.addLayer(baseMap, allCityHighUse); allCityHighUse.on("load" function () { alert(getlayerID ('Test Layer')); }); //or //map.on("layers-add-result", function() { // alert(getlayerID ('Test Layer')); //}); }); //alert(getlayerID ('Test Layer')); function getlayerId(layerName) { var layerInfos = allCityHighUse.layerInfos; for (var i=0, il=layerInfos.length; i<il; i++) { var templayerName = layerInfos.name; var layerId = layerInfos.id; if (templayerName == layerName) { alert(layerId); } return layerId; } }
... View more
08-26-2013
12:25 PM
|
0
|
0
|
1466
|
|
POST
|
Take a look at the video from a session at the 2013 Developers Summit called "Debugging Applications Built with ArcGIS API for JavaScript" (there's also the powerpoint slides to go with it, but it only contains 9 slides). Go to about 40:00 mark where Derek talks about this. Unfortunately, he doesn't have much to say about this, except examine your code.
... View more
08-26-2013
11:21 AM
|
0
|
0
|
3442
|
|
POST
|
This code will zoom the map to its initial extent
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no" />
<title>Simple Map</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.6/js/esri/css/esri.css">
<style>
html, body, #map
{
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
body
{
background-color: #FFF;
overflow: hidden;
font-family: "Trebuchet MS";
}
.my_button
{
position: absolute;
z-index: 100;
left: 10px;
bottom: 10px;
}
</style>
<script src="http://js.arcgis.com/3.6/"></script>
<script>
var map, extent;
require(["esri/map", "dojo/domReady!"], function (Map) {
map = new Map("map", {
basemap: "topo",
center: [-122.45, 37.75], // long, lat
zoom: 13,
sliderStyle: "small"
});
map.on("load", function () {
extent = map.extent;
});
});
function zoomFunction() {
map.setExtent(extent);
}
</script>
</head>
<body>
<div id="map">
<button type="button" class="my_button" onclick="zoomFunction();">Zoom to Original Extent</button>
</div>
</body>
</html>
... View more
08-26-2013
08:03 AM
|
0
|
0
|
3507
|
|
POST
|
Is there a reason you're using the old version of the API (1.6 instead of 3.6)? Take a look at this sample that has a button to draw a rectangle to select features.
... View more
08-23-2013
11:30 AM
|
0
|
0
|
473
|
|
POST
|
I'm not getting the extra click event on IE 9.0.8112.16421, Chrome 29.1.1547.57, or Firefox 17.0.8 on Windows 7 Enterprise, Service Pack 1 with your new fiddle
... View more
08-23-2013
06:24 AM
|
0
|
0
|
5144
|
|
POST
|
Fieldset was introduced in Dojo 1.9. Since the JSAPI 3.6 is based on Dojo 1.8.3, it wasn't an oversight.
... View more
08-21-2013
11:49 AM
|
0
|
0
|
946
|
|
POST
|
You can programmatically build a template with all the visible fields for multiple layers. This is how I did it for one application, but I also had modified the MXD file for the service to show only certain fields with aliases. This also leaves off the OBJECTID and SHAPE fields from the content.
function executeIdentifyTask(evt) {
map.graphics.clear();
identifyParams.geometry = evt.mapPoint;
identifyParams.mapExtent = map.extent;
var deferred = identifyTask.execute(identifyParams);
deferred.addCallback(function (response) {
return dojo.map(response, function (result) {
var feature = result.feature;
var contentString = "";
var sp = feature.attributes;
contentString += "<b>" + result.layerName + "</b><hr width = '90%'>";
for (var x in sp) {
if (x !== "OBJECTID" && x !== "Shape") {
contentString += "<i>" + x + "</i>: " + feature.attributes + "<br/>";
}
}
var infoTemplate = new esri.InfoTemplate();
infoTemplate.setTitle("Results");
infoTemplate.setContent(contentString);
feature.setInfoTemplate(infoTemplate);
return feature;
});
});
map.infoWindow.setFeatures([deferred]);
map.infoWindow.show(evt.mapPoint);
}
... View more
08-21-2013
08:32 AM
|
0
|
0
|
637
|
|
POST
|
Hi Manila, Your page doesn't have a div named "tc1-prog" to put the tab container. You also added the JSAPI script twice.
<body class="claro">
<div id="mapDiv"></div>
<div id="tc1-prog"></div>
</body>
</html>
Here's an example of putting a tab container into a infoWindow (although the tabs are not rendered correctly). Also, if you post code in the forum, please put it into a block using the # button above. It makes it easier to read.
... View more
08-20-2013
12:18 PM
|
0
|
0
|
1199
|
|
POST
|
I think the issue is that you're putting the executeIdentifyTask into the map's onLoad event, so it's not going to fire when you expect. Instead, you want this to fire when the user clicks on the Confirm button. Try something like this instead
gsvc = new esri.tasks.GeometryService("http://bl-arcgis-1/ArcGIS/rest/services/Geometry/GeometryServer");
dojo.connect(map, "onClick", markpoint);
dojo.connect(map, "onLoad", mapReady);
function markpoint(evt) {
//rest of function
graphic.setInfoTemplate(new esri.InfoTemplate("HERE?",
"<p> X: " + pt.x +
"<br/> Y: " + pt.y +
"</p>" +
"<input type='button' value='CONFIRM' onclick='executeIdentifyTask(evt);' />" +
"<div id='latlong'></div>"));
//rest of function
}
function mapReady(map){
//function executeIdentifyTask(){
alert("line 87");
//dojo.connect(map,"onLoad",executeIdentifyTask);
//create identify tasks and setup parameters
identifyTask = new esri.tasks.IdentifyTask("http://bl-arcgis-1/ArcGIS/rest/services/CRM/MapServer");
// rest of function
}
Please remember to put your code into the block (using the # button above). It makes it much easier to read.
... View more
08-20-2013
09:27 AM
|
0
|
0
|
1816
|
|
POST
|
Thanks Ken. I just tried using the centerAndZoom method and it worked perfectly. map.centerAndZoom(resultFeatures[0].geometry, .01); Will You should check what happens when you try this multiple times to see if it continues to zoom in. And when you find posts useful, made good use of the "This post was helpful" up-arrow 🙂
... View more
08-16-2013
06:18 AM
|
0
|
0
|
523
|
|
POST
|
You can use the centerAndZoom method, which allows you to use a zoom factor.
... View more
08-16-2013
05:05 AM
|
0
|
0
|
2659
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 02-04-2025 06:39 AM | |
| 1 | 05-01-2026 08:26 AM | |
| 1 | 04-10-2026 12:01 PM | |
| 1 | 04-13-2026 09:11 AM | |
| 1 | 10-11-2023 06:18 AM |
| Online Status |
Online
|
| Date Last Visited |
4 hours ago
|