New answers tagged

0

you can create a FeatureLayer via a FeatureCollection, which is essentially just all your data, with a schema defined. You pass your FeatureCollection instead of the FeatureLayer URL: var featureLayer = new FeatureLayer(featureCollection, { showLabels: true }); Helpful links: FeatureLayer Constructor from FeatureCollection FeatureSet Feature Layer ...


1

in 4.x of our ArcGIS API for JavaScript, its as easy as checking FeatureLayer.renderer. in 3.x, besides looping through individual graphics, you can also find the renderer documented in the service metadata. esriRequest({ "url": serviceUrl, "content": { "f": "json" }, "callbackParamName": "callback" }). then(function (evt) { console....


1

If your FeatureLayer uses a SimpleRenderer, you may access its symbol with myFeatureLayer.renderer.symbol. If not, you have to check the symbol per Graphic. You can either ask its Renderer about the symbol with the getSymbol() method, or you can iterate over the array of graphics and get the symbol for each one: var symbols = [] myFeatureLayer.graphics....


0

My answer to this earlier question has a code example of how to accomplish this: http://gis.stackexchange.com/a/199366/72254


0

Here is an example of the code I used to do this. This will work for your case if you set the initial extent of the map to show the US: //This function limits the extent of the map to prevent users from scrolling //far away from the initial extent. function limitMapExtent(map) { var initialExtent = map.extent; map.on('extent-change', function(event)...


0

The map.getScale() method returns the X value in 1:X, where 1 and X have the same unit. When you see a map scale of 144447.638, that's 1 map inch = 144447.638 real world inches (or 1 map meter = 144447.638 real world meters). If you want to convert the unit of the second measurement to miles, just convert the map.getScale() value from inches to miles. ...


1

I changed your example using a PictureMarkerSymbol and it works. The image and the html page are on the same webserver. Here's the code: <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"> <title>3D Graphics - 4.0</title> <...


1

@lele3p is correct. the best option here is to host the image on the same domain as the application. you can information about CORS and using a proxy as a failsafe in instances where it is either not possible to enable CORS on the web server hosting resources or in legacy browsers like IE9 and < here: https://developers.arcgis.com/javascript/3/jshelp/...


1

if you snoop the network traffic in this sample, you'll see that additional queries for the attributes of related records aren't made under an individual feature has been clicked. this is because only the attributes present in the feature service itself are available automatically for filtering. as an alternative, you could: query the table of related ...


0

I believe that analysisResultLyr.setLayerDefinitions(layerDefinitions); will trigger a refresh automatically after updating the layer definitions see https://developers.arcgis.com/javascript/3/jsapi/arcgisdynamicmapservicelayer-amd.html#setlayerdefinitions. I think your call to refresh may be interfering with some async behaviour with the layer definition ...


1

When modern browsers behave dramatically differently it is usually worth validating your HTML using an online validator such as https://validator.w3.org/ since how they handle invalid html varies much more than how they handle valid html. In particular look for unclosed tags in the popups. If you can't get this to work I suggest posting the content of one of ...


0

I got an answer on Geonet, thanks to Yusuf Ali! Step 1, hide deleting: .deleteAttachment{display:none;} Step 2, prevent adding new attachments: dojo.query('> div > form', dojo.byId("attachment-editor-container")).style('display', 'none'); Step 3, hide parentheses left after hiding the delete icons: var spans = dojo.query('> div > span &...


2

yes. definitely possible. check out this sample which demonstrates how to pull out url parameters and manipulate the map. https://developers.arcgis.com/javascript/3/jssamples/exp_history.html


2

For the first question of renaming the layers, just add an "id" property when constructing the FeatureLayer: var resLyrLn = new FeatureLayer("https://data.farwestern.com/arcgis/rest/services/scratch/test_SD_RelatedResources/MapServer/0", { mode: FeatureLayer.MODE_ONDEMAND, visible: true, id: "My Layer"}); The second question about checkbox layer ...


0

function drawroute(drawroute) { var Coordinate = new Array(); Coordinate = drawroute; var long = Coordinate.split(",")[0]; var lat = Coordinate.split(",")[1]; var long1 = Coordinate.split(",")[2]; var lat1 = Coordinate.split(",")[3]; routeTask = ...


0

Here are two suggestions: Keep working with the Query/QueryTask and specify the outSpatialReference https://developers.arcgis.com/javascript/3/jsapi/query-amd.html#outspatialreference Instead of using the Query/QueryTask, use the FeatureLayer and it's setDefinitionExpression() method instead. This will usually perform better: https://developers.arcgis.com/...


0

It appears that Derek's answer above no longer works at version 3.16 of the JS API. An update came from Kelly Hutchins at Esri, and is to add the custom basemap to esri/basemaps as shown at https://developers.arcgis.com/javascript/3/jsapi/esri.basemaps-amd.html require([ "esri/basemaps", "esri/map", "dojo/domReady!" ], function (esriBasemaps, ...


0

I changed the map service's coordinate system to WGS 1984 and it works. Still curious about if there is a way to change the map's projection to feature layer's.


1

I was able to piece together some code that essentially just re-projects the coords via a geometry service. I'm assuming that this is somewhat a 'duh' answer to most, but just throwing it out there. That being said, I can get an extent but it doesn't seem to zoom in to the correct location. I'll create a separate post for this issue if I can't figure it ...


2

you don't have graphics on map because : 1-the service returns feature without geometry attribute . and this is due to a typing error in your above code : Just rectify the line myQuery.returnGeomery = true; ( t letter missed ) to this myQuery.returnGeometry = true; 2- in the showResults function : inside the loop you didn't make instanciation of the ...


0

Looking at the code it seems like the value of myQuery.where is an empty string. Just before the line myQueryTask.execute(myQuery,showResults); assign the value to whereExpression like below myQuery.where = whereExpression;


1

Re-order the features when the Popup's on-set-features event fires. EDIT Here is a code snippet of how to do this: function bindInfoWindowSortingFunction(map) { require(['dojo/_base/connect'], function (connect) { connect.connect(map.infoWindow, "onSetFeatures", function () { var orderedFeatures = []; for(var i = ...


0

Set quantize to false before adding featureLayer to map. featureLayer.quantize = false;


0

If you have created the feature layer on the client side (no server side url), then you cannot use a query with a where clause. I was able to work around this by searching the extent of the map and then deleting all the items that I found. For example: function removeAllLayerFeatures(map, layer) { require(['esri/tasks/query', 'esri/layers/FeatureLayer'],...


1

try this for (var j = 0, k = map.layerIds.length; j < k; j++) { var currentLayer = map.getLayer(map.layerIds[j]); if (currentLayer.id == "yourLayerID") { map.removeLayer(currentLayer); }


0

It's clunky but you can query on the extent of the map and then loop through the results to get the attributes you want. For example: require(['esri/tasks/query', 'esri/layers/FeatureLayer'], function (Query, FeatureLayer) { var query = new Query(); query.geometry = projectsOverlayMap.extent; featureLayer.selectFeatures(query, FeatureLayer....


0

I wrote to Esri team and they told this is a bug on 4.0. And it will be fixed with 4.1, which will be released fall this year (2016).


1

In your Feature( or map ) Service using arcmap ; connect to your arcgis server , locate the service and open service edit window, in the right menu locate the parameters and reset the value of Maximum number of record returned by the server it's set to 1000 by default , change it to 5000 . (greater the value is set, lower the performance of server will be )...


0

After many tedious and failed attempts at trying to figure this out, I finally got it figured out. Since the AttributeTable is an off panel widget, it is opened in a different way than on panel widgets. Inside the AttributeTable widget.js file, the open method invokes this._openTable(). Since my custom widget.js file also contains the open function, I ...


1

As mentioned , you have to set an ajax request to service-url?f=json and loop the Layers tab json response to access each layer name , id ... same thing to generate check boxes . required js => "esri/request", ajax req "dojo/dom-construct", creating dynamic checkbox "dojo/_base/array", looping json Layers array You can find a sample ...


0

if you're looking for metadata describing the layer names, the request you need to make is to the map service itself https://sampleserver5.arcgisonline.com/ArcGIS/rest/services/Energy/Geology/MapServer/?f=json each id and name can be found inside the layers array within the json response.



Top 50 recent answers are included