POST
|
I'd like to set the startExtent to the envelop of a feature that is based on a passed in parameter. I can't figure this out, maybe I'm just not thinking. map.setExtent(feature.geometry.getExtent().expand(1.5));
... View more
01-21-2011
08:41 AM
|
0
|
0
|
293
|
POST
|
this is to allow you to retrieve data from the address candidate, right? but this doesn't work I'm trying to retain the original address geocoded and another unique identifier The outFields include all the fields in the locator features plus some the geocoding related fields such as scores, side etc (you could find out what those fields are by geocoding a single address in ArcMap...).
... View more
01-21-2011
08:18 AM
|
0
|
0
|
284
|
POST
|
That wasn't what he was after, hzhu. He wants something like the 'Halo Mask' found in ArcDesktop. I can't figure out a way to cheat this either, would be a nice feature to have. How about add a rectangle polygon graphic behind the text symbol to simulate the background (caculate the width and length).
... View more
01-21-2011
08:07 AM
|
0
|
0
|
1822
|
POST
|
I am creating a map that will provide coordinates when a point is clicked on the map. I want to have a graphic provided on the clicked location so I am going to using the drawing functionality as well. Where I am stuck so far is how do I clear the last point when a new point is clicked? I have pasted my code below.
<!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" />
<meta name="viewport" content="width=device-width,user-scalable=no"/>
<!--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>Maps Toolbar</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css">
<style type="text/css">
html, body {
height: 100%; width: 100%; margin: 0; padding: 0;
}
</style>
<script type="text/javascript">
djConfig = {
parseOnLoad: true
}
</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("esri.toolbars.draw");
dojo.require("dijit.dijit"); // optimize: load dijit layer
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
var map, toolbar, symbol, geomTask;
function init() {
var startExtent = new esri.geometry.Extent({"xmin":-11721159.665358918,"ymin":-1138850.8106919006,"xmax":8277212.918942982,"ymax":9858297.322750043,"spatialReference":{"wkid":102100}});
map = new esri.Map("map",{extent:startExtent});
dojo.connect(map, "onLoad", createToolbar);
var basemap = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
map.addLayer(basemap);
}
function createToolbar(map) {
toolbar = new esri.toolbars.Draw(map);
//set drawing mode to extent
toolbar.activate(esri.toolbars.Draw.POINT);
dojo.connect(toolbar, "onDrawEnd", addToMap);
}
function addToMap(geometry) {
//toolbar.deactivate();
map.showZoomSlider();
switch (geometry.type) {
case "point":
var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_X, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([0,255,0,1]));
}
var graphic = new esri.Graphic(geometry, symbol);
map.graphics.add(graphic);
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<div id="mainWindow" dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width:100%; height:100%;">
<div id="map" dojoType="dijit.layout.ContentPane" style="border:solid 2px #587498;margin:5px;" region="center">
</div>
</div>
</body>
</html>
add a line map.graphics.clear(); in your function like this: function addToMap(geometry) { //toolbar.deactivate(); map.showZoomSlider(); map.graphics.clear(); switch (geometry.type) { case "point": var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_X, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([0,255,0,1])); } var graphic = new esri.Graphic(geometry, symbol); map.graphics.add(graphic); } OR: set the point graphic as globle variable and add map.graphics.remove(graphic) in your function: function addToMap(geometry) { //toolbar.deactivate(); map.showZoomSlider(); map.graphics.remove(graphic); switch (geometry.type) { case "point": var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_X, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255,0,0]), 2), new dojo.Color([0,255,0,1])); } graphic = new esri.Graphic(geometry, symbol); map.graphics.add(graphic); }
... View more
01-20-2011
09:19 AM
|
0
|
0
|
327
|
POST
|
Any idea how to set up the highlight font? I've seen that effect on an esri map that was written using the web ADF version, but not the Javascript version. I've checked out the API for font and for a textSymbol and neither one mentions a highlight property. Simulate a highlight property by setting font color to (0, 255, 255) similar to selected feature in ArcMap.
... View more
01-20-2011
09:07 AM
|
0
|
0
|
1822
|
POST
|
I'm using the esri google maps extension api... I have a esri.arcgis.gmaps.FeatureSet() (of type esriPolyline) containing an array of features (esri.arcgis.gmaps.Feature()). Is there a simple way to create a single GPolyline from the array of features? or, since feature.geometry is a GPolyline, I guess I am asking is there a simple way to create a single GPolyline by joining/merging multiple GPolylines? FYI - I also asked this question here There are a couple of ways to achieve this. 1. using geometry service's union(geometries, callback?, errback?) method. 2. using Polyline's addPath(points or path or pointJson) method.
... View more
01-20-2011
08:55 AM
|
0
|
0
|
489
|
POST
|
I have a map set up puts dots on the map, and draws lines connecting the dots to create a route. Each dot has a textSymbol next to it that I'm using to label each dot for the user. The problem is that with all the stuff in the background, it can be hard to read those labels sometimes. I'm wondering if there's any way to put a background behind the textSymbol to help it stand out. I know about infoWindows, but I'm already using those when you click on the dot to give you more information. Here's a snippet from my code that runs when it's looping through the route and putting the dots on the map. This is the portion that adds the labels. ...
font = new esri.symbol.Font("10pt", esri.symbol.Font.STYLE_NORMAL,
esri.symbol.Font.VARIANT_NORMAL,esri.symbol.Font.WEIGHT_NORMAL,"Verdana");
...
var textSymbol = new esri.symbol.TextSymbol(feature.attributes["LABEL"]).setColor(new dojo.Color([255, 0, 0])).
setOffset(30, 0).setFont(font).setKerning(true);
var point = new esri.geometry.Point(feature.attributes["NNLL_LONG_DEC"], feature.attributes["NNLL_LAT_DEC"], map.spatialReference);
map.graphics.add(new esri.Graphic(point, textSymbol));
... Any ideas? I am not sure that you could add backgroud to textSymbol. However, you can make it standing out by setting up highlight font, certain angle or decoration (overline or underline). Note: decoration might not work on certain browsers.
... View more
01-19-2011
10:39 AM
|
0
|
0
|
1822
|
POST
|
I'm a real newbie and have a web app that embeds an ArcGIS map using the JavaScript API. I used the sample code from the following and have my app working: http://help.arcgis.com/EN/webapi/javascript/arcgis/help/jssamples/map_explicitlayerlist.html If you visit the URL above, you'll see it uses layer ids for the default layers to be displayed (i.e., "imageParameters.layerIds = [2];" and "visible = [2];"). I currently have mine set to use layer ids, but I needed more than 1 layer displayed by default, so I currently have: "imageParameters.layerIds = [0,1,20,21,22];" and "visible = [0,1,20,21,22];". However, over time, the layer order will change because I'll be adding new layers. Therefore, I want to refer to the layers by name, instead of id. How do I modify the code at the sample URL above to set the default layers to display using layer names, instead of layer ids? Thanks, Steve For both ArcGISDynamicMapServiceLayer and ArcGISTiledMapServiceLayer, there is a property call layerInfos which is LayerInfo[]. Each element of the array is a object of LayerInfo which has id, name etc properties. You can use it for your purpose. See Javascript API Reference for more detail.
... View more
01-12-2011
10:49 AM
|
0
|
0
|
1193
|
POST
|
I took the code that Kelly wrote in this article on the ArcGIS Server Blog and updated it to use the latest API. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Populate dropdown list with unique values</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css">
<style type="text/css">body,html,#main{margin:0;padding:0;height:100%;width:100%;}</style>
<script type="text/javascript">var djConfig = { parseOnLoad:true }</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1"></script>
<script type="text/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("dijit.form.ComboBox");
dojo.require("dojo.data.ItemFileReadStore");
var map;
var resizeTimer;
function init() {
dojo.connect(dijit.byId('map'),'resize',function() { resizeMap(); });
var queryTask = new esri.tasks.QueryTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer/2");
var query = new esri.tasks.Query();
query.outFields = ["ZONING_TYPE"];
query.returnGeometry = false;
query.where = "ZONING_TYPE <> ''";
queryTask.execute(query,populateList);
var initialExtent = new esri.geometry.Extent(-85.915,38.105,-85.52,38.33, new esri.SpatialReference({wkid:4326}));
map = new esri.Map("map", {extent:initialExtent});
map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer"));
map.addLayer(new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_LandRecords_Louisville/MapServer",
{"opacity":.4,"id":"dynamic"}));
}
function populateList(results) {
// populate the dropdown list box with unique values
var zone;
var values = [];
var testVals={};
// add option to display all zoning types to the dropdown list
values.push({name:"ALL"})
var features = results.features;
dojo.forEach (features, function(feature) {
zone = feature.attributes.ZONING_TYPE;
if (!testVals[zone]) {
testVals[zone] = true;
values.push({name:zone});
}
});
var dataItems = {
identifier: 'name',
label: 'name',
items: values
};
var store = new dojo.data.ItemFileReadStore({data:dataItems});
dijit.byId("mySelect").store = store;
}
function applyLayerDef(selItem) {
// filter the layer to display only the selected zoning types
if (selItem.value !== 'ALL') {
var layerDefs = [];
layerDefs[2] = "ZONING_TYPE = " + "'" + selItem.value + "'";
layerDefs.visibleLayers = [2];
map.getLayer("dynamic").setLayerDefinitions(layerDefs);
} else {
map.getLayer("dynamic").setDefaultLayerDefinitions();
}
}
function resizeMap() {
// handle browser resize
clearTimeout(resizeTimer);
resizeTimer = setTimeout(function() {
map.resize();
map.reposition();
}, 800);
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<div id="main" dojotype="dijit.layout.BorderContainer" design="headline" gutters="true">
<div id="header" dojotype="dijit.layout.ContentPane" region="top" style="height:25px;">
<select id="mySelect"
dojotype="dijit.form.ComboBox"
style="width:300px;font-size:18px;"
autoComplete="true"
forceValidOption="false"
value="Select Zoning Type"
onchange="applyLayerDef(this)">
</select>
</div>
<div id="map" dojotype="dijit.layout.ContentPane" region="center" style="border:1px solid #000;margin:5px"></div>
</div>
</body>
</html> This works fine as is, but it uses the distinct ZONING_TYPE for both the label and the value of the combobox. Let's say I wanted to use the ZONING_CODE as the label and the ZONING_TYPE as the value -- I can't seem to figure out how to add this to the store. Thanks, Glen I am not sure if you can do that unless the each zoning_type is unique. For a select element, the value in each option must be unique.
... View more
01-07-2011
12:04 PM
|
0
|
0
|
242
|
POST
|
Hello, Curious if the Query Task will return overlapping polygons in the same feature layer? I know the Identify Task will do this, but I am working with data that contain relationship classes to SDE tables. From what I've read, the Identify Task is not able to reveal related data, unless I am mistaken. What I am trying to do is select features using a box and returning related attributes to a DataGrid table. So far, I've only been able to pass the top most polygon within the same feature layer and not any underlying polgyons. Your help and suggestions are greatly appreciated! Trent The featureSet from the query task results should contain all the features(featureSet.features) that meet your query parameters. You just have to loop through the featureSet.features to get all the features.
... View more
01-07-2011
11:20 AM
|
0
|
0
|
442
|
POST
|
That's true, there is no onClick documented, however it does work, at least for now! The question then is how do you work with a custom map gallery. It seems like it is being expanded to allow customizing, but it's not there yet, or not documented. If this is not the direction ESRI is going in I will write my own, but need to find out first, or interest in enhancing. I have also noticed it does not update the original map instance to reflect the additional layers I have added to each gallery node, it displays them, but they are not found in map.layers to work with. Thanks, Gary My guess is that because basemap gallery is tied with an div element. so onClick did work (DOM).
... View more
01-06-2011
06:46 AM
|
0
|
0
|
257
|
POST
|
Hi, I have a service returning multiple polygons having same geometry but different attributes as a result all the geometries are getting overlapped on top of other so all the polygons are getting hidden below the top one. Is there any way i could get all the features having same geometry or in other words, how can we compare between geometry objects? Thanks in advance, Ashish using geometry service 's method: relation(relationParameters, callback?, errback?). Note: relationParams.relation = esri.tasks.RelationParameters.SPATIAL_REL_IDENTICAL; In callback, using relation.geometry1Index or relation.geometry2Index to locate the compared geometry... You can look into ESRI samples for more detail
... View more
01-06-2011
06:33 AM
|
0
|
0
|
243
|
POST
|
I have setup a custom BasemapGallery specifying individual layers for each node. I am now looking to set unique extents values for each node (esriBasemapGalleryNode). I am looking for a clean way to identify the selected node so I can index or reference extent values I will maintain for each node. I have not been able to identify the nodes index within the gallery from the object returned from a query locating the esriBasemapGallerySelectedNode. I can loop through the basemap array that I used to initialize the gallery with some string parsing and comparing against each ID parsing out the ID from the selected node, but have concerns it could break with future changes to the map gallery dijit. // 3rd node in the gallery dojo.query('.esriBasemapGallerySelectedNode') esriBasemapGallerySelectedNode returned object referenced has an id: "galleryNode_add_2" // basemap array used to initialize map gallery dijit basemaps: Array[4] 0: Object id: "add_0" layers: Array[1] thumbnailUrl: "images/....png" title: "Landbase" __proto__: Object 1: Object id: "add_1" layers: Array[2] thumbnailUrl: "images/....png" title: "C Zone" __proto__: Object 2: Object id: "add_2" layers: Array[2] thumbnailUrl: "images/....png" title: "F Zone" __proto__: Object 3: Object id: "add_3" layers: Array[2] thumbnailUrl: "images/....png" title: "B Zone" __proto__: Object length: 4 __proto__: Array[0] Snippet of code var zoneLayer = new esri.dijit.BasemapLayer({ url:"http://.../MapServer", visibleLayers:[11,13,14] }); var zoneBasemap = new esri.dijit.Basemap({ layers:[zoneLayer,basemapLayer], title:"Zone", thumbnailUrl:"images/zoneThumb.png" }); basemaps.push(zoneBasemap); // Getting selected node... I can extent to do the parsing and comparing dojo.connect(basemapGallery, "onClick", function(evt) { var sNode = null; sNode = dojo.query('.esriBasemapGallerySelectedNode'); }); Is there anyway to set a user defined property to each esriBasemapGalleryNode on initialization? Is there way to get the index of the esriBasemapGallerySelectedNode? Is there a way to set the ID on each node? Thanks, Gary If you look at the JavaScript API reference, there is no onClick event list on Class: BasemapGallery. I am not sure you could even use something like: dojo.connect(basemapGallery, "onClick", function(evt){});
... View more
01-05-2011
12:01 PM
|
0
|
0
|
257
|
POST
|
Hi Is there anyway to detect if a service is available to avoid having the map wait for a service that may never respond. On occasion the service that my code points to has been known to not respond to my request and in these instances I would like to report this issue to the user. Thanks Have you tried to use onLayerAddResult(layer, error). by testing if error ==null, you will know if the layer add successfully.
... View more
12-29-2010
08:33 AM
|
0
|
0
|
415
|
POST
|
hello,teachers i published mapserver use arcgis server 10 ,i start the service in manager,and can preview it clearly,but i cant find it in the rest catalog, i cleared the rest cache,nothing happend, i restalled the software,nothing happend either,what is the matter? Go to Manager --> Services -->Manage Services and look at the Permissions colum for that service. double click the lock icon to set up the permissions (push the agsadmin and agsusers from the "Available Roles" window on the right to the "Allowed Roles" window on the left). Make sure your account is in either or both user group).
... View more
12-29-2010
06:26 AM
|
0
|
0
|
191
|
Title | Kudos | Posted |
---|---|---|
1 | 04-11-2011 12:16 PM | |
1 | 05-25-2017 08:26 AM | |
1 | 06-02-2017 07:37 AM | |
1 | 06-28-2011 07:02 AM | |
1 | 06-12-2017 10:10 AM |
Online Status |
Offline
|
Date Last Visited |
a week ago
|