POST
|
Thanks for your reply Owen. How do I test the geometry type?
... View more
10-01-2014
03:34 AM
|
0
|
4
|
690
|
POST
|
Hi All, I have a web map with three feature layers and one dynamic map layer, and when I use the legend code it is displaying only the three feature layers. What do I need to display all four layers in the legend. Also how do I add a checkbox to display only the checked layers. Here is the code I'm using. Thanks
//add the legend
map.on("layers-add-result", function (evt) {
var layerInfo = arrayUtils.map(evt.layers, function (layer, index) {
return {layer:layer.layer, title:layer.layer.name};
});
if (layerInfo.length > 0) {
var legendDijit = new Legend({
map: map,
layerInfos: layerInfo
}, "legendDiv");
legendDijit.startup();
}
... View more
10-01-2014
03:28 AM
|
0
|
4
|
3464
|
POST
|
Hi All, I am using the FindTask in my web map (Note: I have point and polygon layers) and it is working fine. When I search using a keyword from the polygon layer it zooms to the polygon and selects the polygon/s using graphics which is what I wanted. However, when I search using a keyword from the point layer, it pans to the center of the selected point/s and doesn't show any graphics. So what I want is, when I search using a point key word, to zoom to the selected point/s and show a circle or square graphics. Below is the code I'm using (Note: I have changed my server name to "myserver:6080"). Thanks.
findTask = new FindTask("http://myserver:6080/arcgis/rest/services/gisdata/webmap/MapServer/");
map.on("load", function () {
//Create the find parameters
findParams = new FindParameters();
findParams.returnGeometry = true;
findParams.layerIds = [0, 1, 2];
findParams.searchFields = ["IDNO", "RESID", "INT", "FTNM"];
findParams.outSpatialReference = map.spatialReference;
console.log("find sr: ", findParams.outSpatialReference);
});
function doFind() {
//Set the search text to the value in the box
findParams.searchText = dom.byId("SEARCH").value;
findTask.execute(findParams, showResults);
}
function showResults(results) {
//This function works with an array of FindResult that the task returns
var markerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 10, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 1.5), new Color([255, 0, 0, 0.5]));
var polygonSymbol = new SimpleFillSymbol(SimpleFillSymbol.STYLE_SOLID, new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0]), 2), new Color([255, 0, 0, 0.5]));
//create array of attributes
var items = arrayUtils.map(results, function (result) {
var graphic = result.feature;
graphic.setSymbol(markerSymbol);
graphic.setSymbol(polygonSymbol);
map.graphics.add(graphic);
return result.feature;
});
var myFeatureExtent = graphicsUtils.graphicsExtent(items);
map.setExtent(myFeatureExtent, true);
}
... View more
10-01-2014
03:11 AM
|
0
|
6
|
2326
|
POST
|
Hi All, I have a web map similar to the one in the code below. There are various option to draw a graphic and select the features inside the polygon. The style of my web map is organised in such away that, where the map is in the center and other functions such as legend in the right pane. However, when I move the graphic buttons to the right pane, the graphic polygon drawing and selection of features is not working. Am I missing something? anyone who can help me fix this, please paste the correct code if you can. Thanks.
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!--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>Shapes and Symbols</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.10/js/esri/css/esri.css">
<style>
#info {
top: 20px;
color: #444;
height: auto;
font-family: arial;
right: 20px;
margin: 5px;
padding: 10px;
position: absolute;
width: 115px;
z-index: 40;
border: solid 2px #666;
border-radius: 4px;
background-color: #fff;
}
html, body, #mapDiv {
padding:0;
margin:0;
height:100%;
}
button {
display: block;
}
</style>
<script src="http://js.arcgis.com/3.10/"></script>
<script>
var map, tb;
require([
"esri/map", "esri/toolbars/draw", "dojo/promise/all",
"esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol",
"esri/symbols/PictureFillSymbol", "esri/symbols/CartographicLineSymbol", "esri/layers/FeatureLayer",
"esri/graphic", "esri/tasks/query", "esri/tasks/QueryTask", "esri/InfoTemplate",
"esri/Color", "dojo/dom", "dojo/on", "dojo/domReady!"
], function(
Map, Draw, All,
SimpleMarkerSymbol, SimpleLineSymbol, SimpleFillSymbol,
PictureFillSymbol, CartographicLineSymbol, FeatureLayer,
Graphic, Query, QueryTask, InfoTemplate,
Color, dom, on
) {
map = new Map("mapDiv", {
basemap: "streets",
center: [-85.82966, 33.666494],
zoom: 13
});
map.on("load", initToolbar);
var featureLayer1 = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/0",{
mode: FeatureLayer.MODE_SELECTION,
infoTemplate: new InfoTemplate("Block: ${BLOCK}", "${*}"),
outFields: ["POP2000","HOUSEHOLDS","HSE_UNITS", "TRACT", "BLOCK"]
});
var featureLayer2 = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/1",{
mode: FeatureLayer.MODE_SELECTION,
infoTemplate: new InfoTemplate("Block Group: ${BLKGRP}", "${*}"),
outFields: ["POP2000","HOUSEHOLDS","HSE_UNITS", "TRACT", "BLKGRP"]
});
var featureLayer3 = new FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/2",{
mode: FeatureLayer.MODE_SELECTION,
infoTemplate: new InfoTemplate("County Name: ${NAME}", "${*}"),
outFields: ["POP2000","HOUSEHOLDS","HSE_UNITS","NAME"]
});
map.addLayers([featureLayer1, featureLayer2, featureLayer3]);
// markerSymbol is used for point and multipoint, see http://raphaeljs.com/icons/#talkq for more examples
var markerSymbol = new SimpleMarkerSymbol();
markerSymbol.setPath("M16,4.938c-7.732,0-14,4.701-14,10.5c0,1.981,0.741,3.833,2.016,5.414L2,25.272l5.613-1.44c2.339,1.316,5.237,2.106,8.387,2.106c7.732,0,14-4.701,14-10.5S23.732,4.938,16,4.938zM16.868,21.375h-1.969v-1.889h1.969V21.375zM16.772,18.094h-1.777l-0.176-8.083h2.113L16.772,18.094z");
markerSymbol.setColor(new Color("#00FFFF"));
// lineSymbol used for freehand polyline, polyline and line.
var lineSymbol = new CartographicLineSymbol(
CartographicLineSymbol.STYLE_SOLID,
new Color([255,0,0]), 10,
CartographicLineSymbol.CAP_ROUND,
CartographicLineSymbol.JOIN_MITER, 5
);
// fill symbol used for extent, polygon and freehand polygon
var fillSymbol = new SimpleFillSymbol();
function initToolbar() {
tb = new Draw(map);
tb.on("draw-end", addGraphic);
// event delegation so a click handler is not
// needed for each individual button
on(dom.byId("info"), "click", function(evt) {
if ( evt.target.id === "info" ) {
return;
}
var tool = evt.target.id.toLowerCase();
map.disableMapNavigation();
tb.activate(tool);
});
}
function addGraphic(evt) {
//deactivate the toolbar and clear existing graphics
tb.deactivate();
map.enableMapNavigation();
// figure out which symbol to use
var symbol;
if ( evt.geometry.type === "point" || evt.geometry.type === "multipoint") {
symbol = markerSymbol;
} else if ( evt.geometry.type === "line" || evt.geometry.type === "polyline") {
symbol = lineSymbol;
}
else {
symbol = fillSymbol;
}
map.graphics.add(new Graphic(evt.geometry, symbol));
queryMapService(evt.geometry);
}
function queryMapService(Geom){
var promises = [];
var query = new Query();
query.returnGeometry = false;
query.outFields = ["*"];
query.geometry = Geom;
promises.push(featureLayer1.selectFeatures(query, FeatureLayer.SELECTION_NEW));
promises.push(featureLayer2.selectFeatures(query, FeatureLayer.SELECTION_NEW));
promises.push(featureLayer3.selectFeatures(query, FeatureLayer.SELECTION_NEW));
var allPromises = new All(promises);
allPromises.then(function (r) { showResults(r); });
}
function showResults(results) {
var resultCount = results.length;
console.log(resultCount);
}
});
</script>
</head>
<body>
<div id="info">
<div>Select a shape then draw on map to add graphic</div>
<button id="Point">Point</button>
<button id="Multipoint">Multipoint</button>
<button id="Line">Line</button>
<button id="Polyline">Polyline</button>
<button id="FreehandPolyline">Freehand Polyline</button>
<button id="Triangle">Triangle</button>
<button id="Extent">Rectangle</button>
<button id="Circle">Circle</button>
<button id="Ellipse">Ellipse</button>
<button id="Polygon">Polygon</button>
<button id="FreehandPolygon">Freehand Polygon</button>
</div>
<div id="mapDiv"></div>
</body>
</html>
... View more
09-29-2014
01:37 AM
|
0
|
3
|
7420
|
POST
|
Hi All, I have a web map with three feature layers (1 point and 2 polygon layers), I managed to drag a rectangle and select features from one of the polygon layers inside the rectangle and clear the selected feature. Plus I have a drawing toolbar where I can draw point, line and polygon features. What I need to do now is that if I draw a polygon graphic, the features from the three feature layers inside the graphic polygon to be selected and the graphic polygon shown.
... View more
09-17-2014
09:23 AM
|
0
|
2
|
1140
|
POST
|
Somphaby, Dumb question, did you check (http://localhost) if your web browser is displaying the IIS page?
... View more
09-16-2014
03:56 AM
|
0
|
1
|
433
|
POST
|
Apart from the common interview preparation protocols, the best way to prepare for the interview is to research the application of GIS in the field (position) you are being interviewed and refer the employer's website.
... View more
09-16-2014
03:44 AM
|
0
|
2
|
677
|
POST
|
Hi All, I have managed to solve the geometry service without using proxy, just by pointing the new GeometryService to my ArcGIS Server Geometry Service URL as follows (Note that I have changed the name of my server to 'myserver'). new GeometryService("http://myserver:6080/arcgis/rest/services/Utilities/Geometry/GeometryServer"); However, I still need help with the PrintTask. Can anyone help please?
... View more
09-16-2014
03:16 AM
|
0
|
2
|
346
|
POST
|
Hi All, Is there another way of referencing geometry services or PrintTask using JavaScript other than using proxy? I want to buffer graphics and use PrintTask without using the following code. esriConfig.defaults.io.proxyUrl = "<url_to_proxy>" esriConfig.defaults.io.alwaysUseProxy = false; Thanks
... View more
09-15-2014
02:34 AM
|
0
|
3
|
1010
|
POST
|
Thanks Jake and Robert, both codes can do the job, however the correct answer choice accepts only one answer.
... View more
09-11-2014
08:08 AM
|
0
|
1
|
542
|
Title | Kudos | Posted |
---|---|---|
1 | 11-20-2015 05:34 AM | |
1 | 09-04-2014 08:17 AM | |
3 | 02-12-2015 03:45 AM | |
1 | 10-16-2014 02:24 AM | |
1 | 10-24-2014 02:53 AM |
Online Status |
Offline
|
Date Last Visited |
3 weeks ago
|