|
POST
|
Please contact support if you're unable to get it working by following the steps outlined here: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/ags_proxy.htm
... View more
10-13-2011
07:06 AM
|
0
|
0
|
3411
|
|
POST
|
The solution will be use javascript Object instead of JSON to specify your address parameter. It's more consistent. Replace your statement var Street = { "SingleLine": dojo.byId("address").value }; with these: var Street =new Object(); Street.Street =dojo.byId("address").value; I am pretty sure it will work. Heming- those two produce the same thing, it's just two different syntactical styles. After all, JSON stands for JavaScript Object Notation. Explicitly creating an object via new Object() or with object literal notation will produce the same thing. In the case of gis_tech's code, the problem was the name of the property being specified. The locator expected "Streets" and the code was using "SingleLine".
... View more
10-12-2011
01:22 PM
|
0
|
0
|
2120
|
|
POST
|
Also, for future debugging, it's a good idea to pass an errBack function when calling addressToLocations or connect to your locator's onError event to log events(this applies to all tasks in the JS API). Something like this:
dojo.connect(locator, "onError", errorHandler);
... View more
10-12-2011
11:24 AM
|
0
|
0
|
2120
|
|
POST
|
What are you using to debug your app? I prefer a mix of firefox+firebug and chrome (with its built-in dev tools). If I take a look at the network section of Chrome dev tools, I see this request being sent when the "Locate" button is clicked: http://restdata.umatilla.nsn.us/ArcGIS/rest/services/CTUIRAddressLocator/GeocodeServer/findAddressCandidates?SingleLine=202%20Birch%20Loop&f=json&outSR={%22wkid%22%3A102100}&callback=dojo.io.script.jsonp_dojoIoScript2._jsonpCallback So...the street parameter is missing. Change this:
var Street = { "SingleLine": dojo.byId("address").value };
To this:
var Street = { "Street": dojo.byId("address").value };
... View more
10-12-2011
10:19 AM
|
0
|
0
|
2120
|
|
POST
|
Try with the latest version of the API: http://help.arcgis.com/en/webapi/javascript/arcgis/index.html Let us know if you have any luck using v2.5 and this sample as a template: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/locator_address.html
... View more
10-12-2011
08:36 AM
|
0
|
0
|
2120
|
|
POST
|
Your proxy has to live on the same server as your JS API app. Are you able to contact support for help? This is something that they should be able to walk you through.
... View more
10-11-2011
11:28 PM
|
0
|
0
|
3411
|
|
POST
|
Agreed with hzhu, save the current tool as a global or as a property on some global object when you activate your toolbar.
... View more
10-11-2011
02:33 PM
|
0
|
0
|
1108
|
|
POST
|
The outFields property name is case-sensitive, see this sample for context: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/query_nomap.html
... View more
10-11-2011
07:51 AM
|
0
|
0
|
457
|
|
POST
|
What do you want to do? If you really need to know, look at navToolbar._navType.
... View more
10-11-2011
05:35 AM
|
0
|
0
|
1108
|
|
POST
|
Despite the name, the navigation toolbar doesn't actually have to be a traditional toolbar. You can wire it up to any UI elements you wish. The sample we provide just happens to use it in the traditional toolbar sense. Regarding "cursor of the graphic" ... if I understand correctly, you want map.setMapCursor().
... View more
10-11-2011
05:31 AM
|
0
|
0
|
856
|
|
POST
|
I'm not sure I completely understand your question but here are a few things I noticed: -you're using a map service in web mercator(wkid 102100) but specifying a geographic extent(wkid 4326). Use esri.geometry.geographicToWebMercator() to convert your extent before passing it to your map:
var initialExtent = new esri.geometry.Extent({"xmin":-120.227821999585,"ymin":20.5332698820995,"xmax":-65.9816769016675,"ymax":71.4062353670687,"spatialReference":{"wkid":4326}});
map = new esri.Map("mapDiv", {
extent: esri.geometry.geographicToWebMercator(initialExtent)
});
-you're adding a tile map service but using the dynamic map service constructor. Use:
var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
-to handle resizing of the browser use this:
dojo.connect(map, 'onLoad', function() {
// handle resize of the browser
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
//Listen for click event on the map, when the user clicks on the map call executeQueryTask function.
dojo.connect(map, "onClick", executeQueryTask);
});
Note: the map's onLoad event is also where you should connect your onClick handler Here's a tweaked version of your whole 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" />
<!--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>QueryTask with geometry, results as an InfoWindow</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.5/js/dojo/dijit/themes/claro/claro.css">
<style type="text/css">
html, body {height: 100%; width: 100%; margin: 1; padding: 0;}
body{background-color:#730; overflow:hidden; font-family: "Trebuchet MS"; border:5px solid black}
#map{overflow:hidden; padding:0;}
.AppTitle{font-size:3em; color: yellow;}
.esriScalebar{height: 60%;}
</style>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.5"></script>
<script type="text/javascript" language="Javascript">
dojo.require("esri.map");
dojo.require("esri.tasks.query");
dojo.require("dojo.parser");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.dijit.Scalebar");
var map, queryTask, query;
var symbol, infoTemplate;
function init() {
var initialExtent = new esri.geometry.Extent({"xmin":-120.227821999585,"ymin":20.5332698820995,"xmax":-65.9816769016675,"ymax":71.4062353670687,"spatialReference":{"wkid":4326}});
map = new esri.Map("mapDiv", {
extent: esri.geometry.geographicToWebMercator(initialExtent)
});
//create and add new layer
var layer = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
map.addLayer(layer);
dojo.connect(map, 'onLoad', function() {
// handle resize of the browser
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
dojo.connect(map, "onClick", executeQueryTask);
});
//build query task
queryTask = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/5");
query = new esri.tasks.Query();
query.returnGeometry = true;
query.outFields = ["STATE_NAME", "STATE_ABBR", "SQMI", "MALES", "FEMALES"];
//create the infoTemplate to be used in the infoWindow.
//All ${attributeName} will be substituted with the attribute value for current feature.
infoTemplate = new esri.InfoTemplate("${STATE_NAME}", "Abbreviation: ${STATE_ABBR}<br />Square Miles: ${SQMI}<br /> # of Males: ${MALES}<br /> # of Females: ${FEMALES}");
symbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([255,255,0,0.5]));
}
function executeQueryTask(evt) {
query.geometry = evt.mapPoint;
queryTask.execute(query, showResults);
}
function showResults(featureSet) {
//remove all graphics on the maps graphics layer
map.graphics.clear();
var features = featureSet.features;
dojo.forEach(features,function(feature){
var graphic = feature;
graphic.setSymbol(symbol);
//Set the infoTemplate.
graphic.setInfoTemplate(infoTemplate);
//Add graphic to the map graphics layer.
map.graphics.add(graphic);
});
dojo.connect(map.graphics, "onMouseMove", function(evt) {
var g = evt.graphic;
map.infoWindow.setContent(g.getContent());
map.infoWindow.setTitle(g.getTitle());
map.infoWindow.show(evt.screenPoint,map.getInfoWindowAnchor(evt.screenPoint));
});
dojo.connect(map.graphics, "onMouseOut", function() {map.infoWindow.hide();} );
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
Click on a state to get more info. When state is highlighted, move mouse over state to get more info.
<div id="mapDiv" style="width:600px; height:600px; border:1px solid #000;"></div>
</body>
</script>
</head>
<body class="claro">
<div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false"
style="width: 100%; height: 100%;">
<div id="map" dojotype="dijit.layout.ContentPane" region="center">
</div>
<div dojotype="dijit.layout.ContentPane" region="top" style="width: 100%; height: 20%;">
<div style="position: absolute; top: 60px; left:900px;"> <span class="AppTitle"> Newbie Test</span> </div>
</div>
</div>
</body>
</html>
... View more
10-10-2011
11:18 AM
|
0
|
0
|
726
|
|
POST
|
This is expected. When you activate a tool from a navigation toolbar, you put your map in navigation mode. If you always want a click to result in an infoWindow showing up, don't use a nav toolbar. Instead, educate your users as to how to navigate using the map's built in shortcuts: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/intro_navigation.htm
... View more
10-10-2011
08:06 AM
|
0
|
0
|
856
|
|
POST
|
Yes, you can use the JS API with any server side platform.
... View more
10-10-2011
08:03 AM
|
0
|
0
|
1049
|
|
POST
|
JavaScript executes asynchronously so the code to create your KMLLayer starts but isn't finished when you're trying to access the folders property. To get your folder info, connect to the KMLLayer's onLoad event:
kmlUrl = 'http://www.hpc.ncep.noaa.gov/kml/qpf/QPF6hr_f00-f06_latest.kml';
kml = new esri.layers.KMLLayer(kmlUrl);
map.addLayer(kml);
dojo.connect(kml, 'onLoad', function(kl) {
alert('kml loaded. folder[1].name is: ' + kl.folders[1].name);
});
This pattern applies to all layer types in the JS API.
... View more
10-09-2011
02:06 PM
|
0
|
0
|
1947
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 01-23-2012 07:54 AM | |
| 1 | 05-28-2010 08:31 AM | |
| 1 | 11-12-2012 08:12 AM | |
| 3 | 02-23-2012 10:57 AM | |
| 1 | 06-27-2011 08:51 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:23 AM
|