Tag Info

New answers tagged

2

Include the dojo/parser and dojo/domReady! modules. Just like in this example https://developers.arcgis.com/javascript/jssamples/widget_basemap.html domReady will ensure that your DOM is loaded, so the map will have the ContentPane height it needs to know before initializing. Your code will look like this. var map; require([ ...


1

You will want to require the Units module "esri/units" and pass the units to the circle this way var circle = new Circle({ center: e.mapPoint, geodesic: domAttr.get(geodesic, "checked"), radius: 100, radiusUnit:units.MILES }); More info on units here


0

Give the polygonSymbol a definition in the constructor var polygonSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_DASHDOT, new esri.Color([255,0,0]), 2),new esri.Color([255,255,0,0.25])); More information here on creating a fill symbol ...


1

IE9 does not support CORS, so the JavaScript API is smart enough to switch to a proxy. Now the proxy typically ends with "/proxy/proxy.ashx" or "/proxy/proxy.php" or "/proxy/proxy.jsp" if using the Esri supplied code which is available here https://github.com/Esri/resource-proxy If your application and the ArcGIS Server are served from the same domain, you ...


0

Note that your REST query encloses the dates within single quotes: DATE_VAL >= '01-01-2014' To match this exactly, you need to enclose the dates within single quotes: query.where = "(DATE_VAL >= '" + startDateQuery + "') AND (DATE_VAL <= '" + endDateQuery + "')";


0

I have a different circumstance where I am dynamically building several dGrids to contain the results of multiple IdentifyTasks on the visible layers in my map (which are in multiple services). Occasionally, there will be fields that contain hyperlinks, so I was happy to come across this thread. From my array of results (contain the promises from each ...


2

I think what you're trying to do would use a combo of the Draw tool and the FeatureLayer applyEdits method. This sample kind of gets you started, but the workflow is use Draw tool, on draw-end event, add drawn graphic using applyEdits method of FeatureLayer. I don't have a solid example on hand, but here is a simple-edit-widget and sample code from my book. ...


0

Layer doesn't have a method called name, but it does have a property called name, so replace this line var updateFeature = featureSet[0].getlayer().name(); with var updateFeature = featureSet[0].getlayer().name;


1

As you said, Esri is just one of many OAuth providers so you'll have to 'roll our own code' in any situation that the individual vendor's samples don't demonstrate exactly what you need to achieve. With regard to whether or not youre missing something basic, i can't really tell from your question. Any authentication you trigger with third party OAuth ...


0

myMap.graphics.add(graphic1); myMap.infoWindow.setFeatures([graphic1]) myMap.infoWindow.show(myMap.toScreen(feature.geometry.getExtent().getCenter()));


0

You can get the selected feature from the attributeInspector this way attInspector._currentFeature


1

The facilities on the map is a featureLayer that comes with graphics that have information you dont need, like the attributes and symbology. You will want to make new graphics based on the graphics in the featureLayer. Replace this line facilities.features = lay.graphics; with this // require the dojo/_base/array module, named arrayUtils here ...


1

Have you seen output spatial reference on the geoprocessing endpoint itself? https://developers.arcgis.com/javascript/jsapi/geoprocessor-amd.html#outspatialreference and Output spatial reference (coordinate system)


1

I am guessing your basemap is in Web Mercator? Handle the graphics and convert their geometry to Web Mercator individually arrayUtil.forEach(graphicsLayer.graphics, function(g){ var geom = esri.geometry.geographicToWebMercator(g.geom); g.setGeometry(geom); });


1

What you are missing is an InfoTemplate on the FeatureLayer. When configuring a pop-up for a layer in a WebMap, you get this "for free". See an example of how to use InfoTemplate with a FeatureLayer https://developers.arcgis.com/javascript/jssamples/fl_popup.html


2

Set the geometry for the graphic using the setGeometry method. Also set the symbol on the graphic OR you may change the renderer (using marker symbols) on the featureLayer when the featureLayer loads. var pointSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_SQUARE, 10, new ...


1

4686 works for FeatureLayers. Don't add GraphicsLayer just by itself. You must add a base layer. Try this example to test a map with just a FeatureLayer, using the map extent in the question http://developers.arcgis.com/javascript/sandbox/sandbox.html?sample=fl_no_basemap Change the value of bounds like this var bounds = new esri.geometry.Extent(-82.00, ...


2

Convert the featureLayers renderer to JSON. Then use the JSON to create a new renderer. var featureLayerRenderer = featureLayer.renderer.toJson(); var renderer = esri.renderer.fromJson(featureLayerRenderer);


0

This github project allowed me to do it: https://github.com/suytt/esri.symbol.MultiLineTextSymbol#sthash.gNpNdlnl.dpuf


0

It is possible! What you need first is a versioned feature class. To be bried, I assume you already know how to create versions and edit them, say using ArcMap or Arcpy. Unfortunately, there is no pre-packaged way to do it in JSAPI (AFAIK in 3.12), however, you can easily create geoprocessing services in Python that will do it though Arcpy and are accessible ...


0

I have looked into this before...and although I do not know how to export JSON in the exact web map spec that you referenced, you can come close using the Item Data operation of the REST API which can exports Web Map data. This might have the information that you require (or not). As I mentioned, the JSON object returned using this operation is not the ...


1

you don't need a programmatic hook into selecting a template immediately. just wire up logic to invoke the appropriate draw tool and pass edits to your hardcoded featureLayer of interest on draw-end immediately upon map load. afterward, you can still listen for selection-change on TemplatePicker and direct the edits somewhere else.


0

In the container that has the legend, set the attribute dir to rtl. Like this http://www.w3schools.com/tags/att_global_dir.asp


2

Change popup.on("selection-change", function(){ to popup.on("set-features", function(){


0

You haven't identified where in the code the error is occurring. I am only guessing it has something to do with the polyline since this line in the code does not appear to be correct: var polyline = new Polyline(geom.spatialReference); Perhaps it should be something like this instead? var polyline = new Polyline(geom); Additional thoughts based on new ...


1

This is not directly available through the API. The PrintTask can be used to get the Web_Map_as_JSON. map.on("load", function(){ require(["esri/tasks/PrintTask", "dojo/_base/json"], function(PrintTask, JSON){ var printTask = new PrintTask(); var Web_Map_as_JSON = JSON.toJson(printTask._getPrintDefinition(map)); }); });


0

If you are doing it in arcpy, then I think you are looking for Project (Data Management): arcpy.Project_management (in_dataset, out_dataset, out_coor_system, {transform_method}, {in_coor_system}) For model based geoprocessing services, I think there is an alternative, but you might be able to just wrap this into one.


1

i think the jsapi documentation could be a little clearer on this point, but you need to supply whatever string that the particular service you are working with expects. as mentioned in the service documentation, acceptable values for impedanceAttribute are 'TravelTime' (default) 'TruckTravelTime' 'WalkTime' 'Miles' 'Kilometers' if you provide anything ...


0

at v3.12, try to use getDomain, fl.getDomain("fieldName") https://developers.arcgis.com/javascript/jsapi/featurelayer-amd.html#getdomain


0

I really appreciate all the suggestions, but I never got the esri/dijit/Popup to be moveable and still be able to highlight and copy the text inside. Instead I used a jQuery Dialog, which I figured would be the case but it just took a while to get all the experience needed to make it work the way I wanted it to. My boss and I both worked on it and we still ...


0

If you don't mind trading the dropdown menu with text for a dropdown menu with thumbnail images of the basemaps, the ArcGIS Basemap Gallery Widget can help you with this.


1

onChange: function (value) { var min = value[0]; var max = value[1]; var expression = "POP_Total_Class >= " + min + " AND POP_Total_Class <= " + max; POP_Total.setDefinitionExpression(expression); }


1

Intercept the Print request by using the esri/request setRequestPreCallback method. Parse the WebMap String to convert it to JSON. Change your layer id's and stringify back. esriRequest.setRequestPreCallback(function(ioArgs) { if (ioArgs.content && ioArgs.content.Web_Map_as_JSON){ //Intercept Print Call var webMapAsJson = ...


0

Okay I found the problem. We are using Kendo as well. I was attaching features to a Kendo tree control which was mutating the ESRI objects. For some reason it didn't affect polygons and points. I just recreate the polyline features from the Kendo objects before adding to the map and that is working.


0

The cmv projections widget contributed by the community is a good place to start. That widget does what you ask plus showing coordinates in multiple projections.


0

It looks like you want to use Bootstrap for your dropdown menu. This sample does something similar, only the dropdown ("Maps" in the nav menu) changes the basemap instead of the operational layer: http://esri.github.io/bootstrap-map-js/demo/dojo/maps.html The relevant code is: query("#basemapList li").on(touch.press, function(e) { ...


1

yes, this is feasible. yes, here is an example: https://developers.arcgis.com/javascript/jssamples/portal_addshapefile.html rather than esriRequest, you will need to pass the zipped file as one of your inputParameters when calling Geoprocessor.execute()


0

the jsapi is smart enough to be able to reproject WGS84 geometries added to the map on the fly internally and display them in web mercator {wkid:3857} applications. check out esri/geometry/webMercatorUtils for a look at clientside methods that help you do the same on your own. if you need to reproject between other coordinate systems you'll either need ...


0

Thanks for the help above. It got me on the right track. I couldn't make either of those solutions work (likely due to my own errors), but I did get it to work by removing the featureLayer, setting the renderer, and then adding the featureLayer again: function getRenderer(rendererFromSelect) { renderer = rendererFromSelect.value; switch(renderer) { case ...


0

I suggest doing the graphicUtils.graphicsExtent(), but set a high maxAllowableOffset in your query. This will tremendously decrease server response time.


2

@Michael Miles-Stimson was on track w/ his first comment. since your ArcGIS Tiled Map Service defines its own projection using WKT (as opposed to WKID), you need to use an identical projection definition in your code to indicate to the JSAPI that the point you are passing is in the same coordinate system as the map. check out a working jsbin here another ...


0

If you want to be able to access it globally, one option is to set it this way window.map = response.map; Then you can call map or window.map from anywhere.


2

In the map constructor options, set autoResize to false, eg: var map = new Map("map", { basemap: "topo", center: [-122.45, 37.75], // longitude, latitude zoom: 13, autoResize: false }); https://developers.arcgis.com/javascript/jsapi/map-amd.html#autoresize


0

Change your getRenderer() to this to prevent the featureLayer from flickering I remove the map.removeLayer and map.addLayer. function getRenderer(rendererFromSelect) { renderer = rendererFromSelect.value; switch(renderer) { case "approvalRate": featureLayer.setRenderer(approvalRate); document.getElementById("legend0").style.display ...


1

Ok this is how i solved it. I added a renderer to drawingOptions var sls = new SimpleLineSymbol(SimpleLineSymbol.STYLE_SOLID, esri.Color([255, 255, 0]), 3); drawingOptions.renderer = SimpleRenderer(sls); After i did that i had to enable dynamic workspaces in the service capabilities via the server manager. Hope this helps someone.


1

You could use map.resize(); fire it whenever the browser is resized or when the display attribute of the container changes (dojo.on('id', 'resize', function(){})). Works on most occasions. Or you could use something like map.redraw() or map.refresh() (https://developers.arcgis.com/javascript/jsapi/featurelayer.html#redraw). Key is to tap into the window ...


1

You cannot capture selecting a feature template and creating a feature on the map using, for instance, with Selenium IDE. This is because those things don't happen at the client side, and the testing software is not aware of JS API and considers editing templates to be just a group of CSS elements. Actually, you can test those kinds of interactions. ...


1

as mentioned in the header for this sample, when the server you are making calls to actually supports CORS, you can notify the JSAPI like this. esriConfig.defaults.io.corsEnabledServers.push("server.com") that being said, i don't think sampleserver1.arcgisonline.com supports CORS, so i'd recommend using our production World Geocoding Service instead. in ...


1

You did not provide the template HTML for your button so this is just a guess as to the issue. Your button needs an 'onClick' event to execute your 'clearSelection' method. Something like this: data-dojo-attach-event="onClick:clearSelection" To display an average instead of a sum, you can use the original method you posted with a slight variation: ...


0

Based on my interpretation of your question, I believe that you'd want an onClose method in your widget. This code from the _FloatingWidgetMixin.js file is where that gets handled and directed to your onClose method: if (this.parentWidget && this.parentWidget.declaredClass === 'gis.dijit.FloatingWidget' && this.onClose) { ...



Top 50 recent answers are included