POST
|
When using esri/toolbars/draw, this is what happened if the drawing feature used is a polygon Ex. toolbar.activate(Draw.POLYGON) Once activated the toolbar, on mouse down you start drawing, and with each click you shape the polygon at will. But if in the second click, where you have drawn a line and not a polygon yet, you decide to double-click instead of one click, then the toolbar stop drawing, and draw-end fires, however the result geometry is not a polygon as this feature expect, it is a line in this case. Then you get an error (see image ) I don't think this should be an error. Is there anyway i cant prevent this error from showing up in the console? thanks! roy
... View more
02-18-2015
09:20 AM
|
0
|
0
|
3028
|
POST
|
Thanks Tim. This is a good approach. I am having a hard time to understand why FeatureLayer object doesn't have a getExtent() Method. According to the API documentation, the purpose of this object was to substitute or enhance the Graphic Layer and server-client interaction. But it seems that if you want to play with zooming and extent you have to dig into graphic.geometry. thanks a lot, it was very helpful. Best Roy
... View more
04-08-2014
12:51 PM
|
0
|
0
|
553
|
POST
|
Hello I want to be able to type a state name in a [HTML]<input type="text" id = "statename"></input>[/HTML] and when I click a submit button, two things happen 1 - draw the state in the map ---> I already did this. 2 - zoom to the state extent. (I don't want to use the infoTemplate and then the Zoom to function. I want to be able to call this Zoom to function when I click the submit button) the code:
var map, geocoder, extent, sr, currentExtent, censusdef, featureLayer, loadStates, renderer, selected_state;
require(["esri/map", "esri/layers/FeatureLayer", "esri/InfoTemplate",
"esri/symbols/SimpleLineSymbol", "esri/symbols/SimpleFillSymbol",
"esri/renderers/SimpleRenderer", "esri/tasks/query",
"dojo/parser", "dojo/_base/Color",
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"],
function(Map, FeatureLayer, InfoTemplate,
SimpleLineSymbol, SimpleFillSymbol,
SimpleRenderer,
parser, Color, Query) {
map = new esri.Map("map", {
center: [-96.24, 38.1],
zoom: 4,
basemap: "hybrid"
});
sr = new esri.SpatialReference({wkid:4326});
currentExtent = new esri.geometry.Extent();
var symbol = new SimpleFillSymbol().setColor(new Color([255,0,0,0.4]));
var renderer = new SimpleRenderer(symbol);
featureLayer = new esri.layers.FeatureLayer("http://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer/2", {
//infoTemplate: new InfoTemplate(" ", "${state_name}"),
mode: esri.layers.FeatureLayer.MODE_ONDEMAND,
displayOnPan: true,
styling: true
});
var b = document.getElementById('showstate');
var selected_state = document.getElementById('statename').value;
featureLayer.setDefinitionExpression("state_name = '"+selected_state+"'");
featureLayer.setRenderer(renderer);
b.addEventListener('click', function (){
var b = document.getElementById('showstate');
var selected_state = document.getElementById('statename').value;
//featureLayer.setDefinitionExpression("state_name = '"+selected_state+"'");
featureLayer.setRenderer(renderer);
map.addLayer(featureLayer);
}, false);
});
is there anyway to access to the extent of the selected featureLayer? not the entire featurelayer, but only the result after the DefinitionExpression. Something like FeatureLayer.getExtent(); thanks!
... View more
04-08-2014
07:43 AM
|
0
|
2
|
4405
|
Online Status |
Offline
|
Date Last Visited |
06-08-2022
03:28 PM
|