|
POST
|
Also, are you using a proxy page? If you're sending a geometry that is more than a few points you'll want to have a proxy page configured. http://help.arcgis.com/en/webapi/javascript/arcgis/help/jshelp/ags_proxy.htm
... View more
07-15-2010
04:48 PM
|
0
|
0
|
1194
|
|
POST
|
Just remembered that the geometry service functions take Geometry[], not just Geometry. What happens if you pass in [poly] instead of just poly to labelPoints()?
... View more
07-15-2010
04:16 PM
|
0
|
0
|
1194
|
|
POST
|
What is parish.geometry.rings? Is that a single ring or an array of rings? I don't think addRing() can handle an array of rings...
... View more
07-15-2010
01:21 PM
|
0
|
0
|
1194
|
|
POST
|
When you get the response back, loop through the candidates object and save the location object (which has x and y properties with exact coordinates) of each candidate some place where you can access it later.
... View more
07-15-2010
01:18 PM
|
0
|
0
|
425
|
|
POST
|
List to the map's onExtentChange event, figure out the map's scale and enable/disable your base map switching buttons based on the scale.
... View more
07-15-2010
10:27 AM
|
0
|
0
|
348
|
|
POST
|
Derek, Here's a mock up of what I'm trying to do. In the real application the 'Clear Default Graphics Layer' button would be replaced by uncommenting 'map.graphics.clear()' on line 58. The goal is to let the user examine points and add and highlight some to be used later in creating a geologic cross section. Currently however, when the user goes to examine another point, the previously selected point is lost. Ravi, I haven't had a chance to look at your code yet - will do so soon. Thanks, Mike
<!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 http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/1.6/js/dojo/dijit/themes/soria/soria.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=1.6"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.tasks.identify");
var map;
var xSectionFeature;
...snip...
map.graphics.add(feature);
xSectionFeature = feature;
}
...snip...
<div id="map" style="background-color:white; height:600px; width:800px;"></div>
</body>
</html>
I think your problem is the line in red. You should create a new graphic to add to your xSectionGraphics layer rather than assigning xSectionFeature to the object referenced by the feature variable. Changing that line to xSectionFeature = new esri.Graphic(feature.geometry, null, feature.attributes); would do the trick. But then you'll need to do some layer ordering managment...
... View more
07-14-2010
03:33 PM
|
0
|
0
|
1589
|
|
POST
|
Here's a modified version of the multiple graphics layers sample. This is very brittle and just illustrating a point... <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<title>Multiple Graphics Layers</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.0/js/dojo/dijit/themes/tundra/tundra.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0"></script>
<script type="text/javascript" charset="utf-8">
dojo.require("esri.map");
dojo.require("esri.tasks.query");
var map, cityLayer, countyLayer;
function init() {
map = new esri.Map("map", {
extent: esri.geometry.geographicToWebMercator(new esri.geometry.Extent(-102.61, 36.2, -93.82, 40.5, new esri.SpatialReference({wkid: 4326}))),
slider: false
});
dojo.connect(map, "onLoad", doQueries);
dojo.connect(dojo.byId('clear_counties'), 'onclick', function() { countyLayer.clear(); });
dojo.connect(dojo.byId('clear_cities'), 'onclick', function() { cityLayer.clear(); });
dojo.connect(dojo.byId('do_queries'), 'onclick', function() { doQueries(map); });
dojo.connect(dojo.byId('clear_default_graphics'), 'onclick', function() { map.graphics.clear(); });
map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer"));
}
function doQueries(map) {
queryCounties(map);
queryCities(map);
}
function queryCounties(map) {
//Query all counties in Kansas
var countyQueryTask = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Census_USA/MapServer/3");
var countyQuery = new esri.tasks.Query();
countyQuery.outFields = ["*"];
countyQuery.returnGeometry = true;
countyQuery.outSpatialReference = map.spatialReference;
countyQuery.where = "STATE_NAME = 'Kansas'";
countyQueryTask.execute(countyQuery, addCountyFeatureSetToMap);
}
function queryCities(map) {
//Query all cities in Kansas
var cityQueryTask = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer/0/");
var cityQuery = new esri.tasks.Query();
cityQuery.outFields = ["*"];
cityQuery.returnGeometry = true;
cityQuery.outSpatialReference = map.spatialReference;
cityQuery.where = "STATE_NAME = 'Kansas'";
cityQueryTask.execute(cityQuery, addCityFeatureSetToMap);
}
function addCountyFeatureSetToMap(featureSet) {
var symbol = new esri.symbol.SimpleFillSymbol();
symbol.setColor(new dojo.Color([150,150,150,0.5]));
//Create graphics layer for counties
countyLayer = new esri.layers.GraphicsLayer();
map.addLayer(countyLayer);
var infoTemplate = new esri.InfoTemplate("${NAME}","${*}");
//Add counties to the graphics layer
dojo.forEach(featureSet.features, function(feature) {
countyLayer.add(feature.setSymbol(symbol).setInfoTemplate(infoTemplate));
});
}
function addCityFeatureSetToMap(featureSet) {
var symbol = new esri.symbol.SimpleMarkerSymbol();
symbol.setColor(new dojo.Color([0,0,255]));
//Create graphics layer for cities
cityLayer = new esri.layers.GraphicsLayer();
map.addLayer(cityLayer);
map.reorderLayer(cityLayer,1);
var infoTemplate = new esri.InfoTemplate("${CITY_NAME}","${*}");
//Add cities to the graphics layer
dojo.forEach(featureSet.features, function(feature) {
cityLayer.add(feature.setSymbol(symbol).setInfoTemplate(infoTemplate));
});
}
dojo.addOnLoad(init);
</script>
</head>
<body>
<div id="map" class="tundra" style="width:800px; height:400px; border:1px solid #000;"></div>
<button id="clear_counties">Clear Counties</button>
<button id="clear_cities">Clear Cities</button>
<button id="do_queries">Do Queries</button>
<button id="clear_default_graphics">Run map.graphics.clear()</button>
</body>
</html>
... View more
07-13-2010
10:30 AM
|
0
|
0
|
1589
|
|
POST
|
Can you post a more complete code sample? What you're describing isn't making sense to me. If you use map.graphics.clear(), that should clear any graphics on the map's default graphics layer. It shouldn't affect graphics layers you've created and added to the map.
... View more
07-13-2010
10:08 AM
|
0
|
0
|
1589
|
|
POST
|
I don't really understand what you're saying...but every map layer has an onUpdate() event you might be interested in: http://help.arcgis.com/en/webapi/javascript/arcgis/help/jsapi/layer.htm#onUpdate
... View more
07-13-2010
07:51 AM
|
0
|
0
|
325
|
|
POST
|
This is the ArcGIS API for JavaScript forum...you might want to try the Desktop forum: http://forums.arcgis.com/forums/5-ArcGIS-Desktop-General
... View more
07-12-2010
07:33 AM
|
0
|
0
|
311
|
|
POST
|
Geocode the address, use the lat,lng you get from that to search your parcel layer and then zoom to the result?
... View more
07-09-2010
07:24 AM
|
0
|
0
|
801
|
|
POST
|
Spaces are your friend. Are you trying to add URL as a query string parameter? How about: content += "<tr><td>" + layerResults.features.attributes['UPRN'] + "<a href='http://somedomain.com/page.html?url='" + layerResults.features.attributes['UPRN'] + "'>(show)</a></td>";
... View more
07-09-2010
07:21 AM
|
0
|
0
|
454
|
|
POST
|
Something like this: <!DOCTYPE html">
<html>
<head>
<script type="text/javascript">var djConfig = {parseOnLoad: true};</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.0"></script>
<script type="text/javascript">
dojo.require("esri.map");
var field_obj = {};
function init() {
var layer_url = 'http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/Hurricanes/NOAA_Tracks_1851_2007/MapServer/0'
esri.request({
url: layer_url,
content: { f: 'json' },
callbackParamName: 'callback',
load: function(response, io) {
var fields = response.fields;
dojo.byId('fields').innerHTML = '';
dojo.forEach(fields, function(field) {
dojo.byId('fields').innerHTML += 'Name: ' + field.name + '; Alias: ' + field.alias + '<br />';
field_obj[field.name] = field.alias;
});
},
error: function(error) {
console.log('error: ', error);
}
});
}
dojo.addOnLoad(init);
</script>
</head>
<body>
<div id="fields">field names and aliases will show up here.</div>
</body>
</html> You can mess around with the "field_obj" variable in the firebug console since it's global. You would use this object when constructing your info window content to map field names with field aliases.
... View more
07-09-2010
07:15 AM
|
0
|
0
|
1921
|
|
POST
|
My mistake. Are you passing in a function for the third parameter of esri.arcgis.gmaps.QueryTask()? If not, are you listening to the executecomplete event of the QueryTask? The second argument passed to your callback (or executecomplete) function should be an error object if an error occurred. QueryTask documentation: http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/gmaps/help/topics/apiref.htm#class_esri.arcgis.gmaps.QueryTask Error object documentation: http://resources.esri.com/help/9.3/arcgisserver/apis/javascript/gmaps/help/topics/apiref.htm#class_esri.arcgis.gmaps.Error
... View more
07-08-2010
12:52 PM
|
0
|
0
|
816
|
| 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
|