|
POST
|
Hi Tracy- I am a bit new to the JavaScript world, having recently migrated over from the flex api world in the last three months. I began working quite a bit with Jeff Pace recently, whom I'm sure you recognize from this forum, he's in a neighboring county. On a recent project returning feature query results to an onDemand Grid, I used the following. It's all AMD, so hopefully this will help, please forgive the length of my post. BTW, nice app. : Requires (dgrid specific): "dojo/data/ItemFileReadStore", "dojo/store/DataStore", "dojo/store/Memory", "dojo/date/locale", "dgrid/OnDemandGrid", "dgrid/Selection", //only for dgrid with attribute fields from feature layer (obviously I requrie array, on, dom etc) Aliases: ItemFileReadStore DataStore Memory locale declare array In my ready function, initialize the the grid, store it in a div: Some column formatters are inlcuded (are project specific) /*var gridEvac = new (declare([Grid, Selection, TextSymbol]))({ bufferRows : Infinity, noDataMessage : "No Evacuation Zone!", columns : { EvacuationZone : "Evacuation Zone", /*datetime : { "label" : "Date/Time", "formatter" : function(dtStorm) { return locale.format(new Date(dtStorm)); } },*/ SurgeHeight : "Surge Height Range", Hyperlink : { "label" : "Emergency Services", "formatter" : function(link) { return "<a target='_blank' href=https://www.scgov.net/AllHazards/Pages/default.aspx>Click Here</a>"; } } } }, "divGrid"); setting an output fields array to pass to return array from our feature results query in a results function e.g: var outFieldsEvac = ["EvacuationZone", "SurgeHeight"]; function populateGrid(results) { var dataEvac = array.map(results.features, function(feature) { //Reference the attribute field values and set up the return to pass to the grid return { "EvacuationZone" : "Zone " + feature.attributes[outFieldsEvac[0]], "SurgeHeight" : feature.attributes[outFieldsEvac[1]] }; }); //Then // Pass the data to the grid var memStore = new Memory({ data : dataEvac }); gridEvac.set("store", memStore); gridEvac.renderArray(dataEvac); } //populateGrid function close Lastly, if you wish to clear items from the grid: function removeInfoGraphics() { //mapMain.infoWindow.hide(); //mapMain.graphics.clear(); var clearStore = new ItemFileReadStore({data: {identifier: "", items: []}}); gridEvac.setStore(clearStore); //clears the grid, kudos Michael! }; Then some simple styling in a separte css file: #divGrid { width: 100%; } .dgrid { border: none; } .field-EvacuationZone { width: 20%; } .field-SurgeHeight { width: 20%; } .field-Hyperlink { width: 20%; } Thanks- David
... View more
10-30-2013
08:43 AM
|
0
|
0
|
1705
|
|
POST
|
Hi all- Turns out I had a bit of a 500 and a 400 error. In the code below, we are calling in a local network analysis layer that has a different wkid than WebMercator, 2882 vs 3857. So, because I was not explicity setting the outSpatialReference to a new outSpatialReference, the route graphic could not draw. I also had a oversite with my onSolveComplete event callback. Here is the functioning code: routeTask = new RouteTask("https://ags2.scgov.net/arcgis/rest/services/ScOperational/RoutingService/NAServer/Route"); //routeTask = new RouteTask("http://tasks.arcgisonline.com/ArcGIS/rest/services/NetworkAnalysis/ESRI_Route_NA/NAServer/Route"); routeParams = new RouteParameters(); routeParams.attributeParameterValues = [{attributeName: "Oneway", parameterName: "Restriction Usage", value: "Prohibited"}, {attributeName: "RestrictedTurns", parameterName: "Restriction Usage", value: "Prohibited"}]; //routeParams.outSpatialReference = mapMain.SpatialReference; routeParams.outSpatialReference = new SpatialReference({"wkid": 3857}); //2882 routeParams.returnRoutes = true; routeParams.returnStops = true; routeParams.returnDirections = true; routeParams.directionsLengthUnits = Units.MILES; routeParams.impedanceAttribute="Length"; routeParams.stops = new FeatureSet(); connect.connect(routeTask, "onSolveComplete", showRoute); //routeTask.on connect.connect(routeTask, "onError", errorHandler); function addStop(evt) { stopSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CROSS, 15, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([89, 95, 35]), 2 ), new Color([130, 159, 83, 0.40]) ); var stop = new Graphic(evt.mapPoint, stopSymbol); mapMain.graphics.add(stop); routeParams.stops.features.push(stop); if (routeParams.stops.features.length >= 2) { routeTask.solve(routeParams); lastStop = routeParams.stops.features.splice(0, 1)[0]; //what does? } console.log(routeParams.stops.features.length); } function showRoute(solveResult) { routeSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASH, new Color([0, 0, 254]), 3); mapMain.graphics.add(solveResult.routeResults[0].route.setSymbol(routeSymbol)); console.log(solveResult.routeResults[0].route); } function errorHandler(err) { alert("An error occured\n" + err.message + "\n" + err.details.join("\n")); routeParams.stops.features.splice(0, 0, lastStop); //what does? mapMain.graphics.remove(routeParams.stops.features.splice(1, 1)[0]); } Thanks All
... View more
10-15-2013
08:24 AM
|
0
|
0
|
1563
|
|
POST
|
Thanks Steve, What I'm finding is that the route is solving upon adding a third graphic, but the graphic route is not displaying on the map. For some reason the line symbol is simply not returning as a graphic. But thanks for looking at this. No luck on my end with your fix, but I certainly appreicate it- David
... View more
10-14-2013
03:15 PM
|
0
|
0
|
1563
|
|
POST
|
Hello- If anyone can provide assistance with the following code, that would be great. The code works, a route is defined using our internal NA, but does not draw a graphic route upon returning results. I feel certain I have mis-called the route results, and/or am not passing in graphics correctly. Here is the code. It is culled from the existing sample, I have attempted to update syntax to 1.9 var mapMain, routeTask, routeParams, stopSymbol, routeSymbol, lastStop; // @formatter:off require([ "esri/map", "esri/geometry/Extent", "esri/graphic", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/tasks/FeatureSet", "esri/tasks/RouteTask", "esri/tasks/RouteParameters", "esri/tasks/RouteResult", "esri/units", "dojo/parser", "dojo/ready", "dojo/_base/Color", "dijit/layout/BorderContainer", "dijit/layout/ContentPane"], function( Map, Extent, Graphic, SimpleMarkerSymbol, SimpleLineSymbol, FeatureSet, RouteTask, RouteParameters, RouteResult, Units, parser, ready, delcare, Color, BorderContainer, ContentPane ) { ready(function() { mapMain = new Map("cpCenter", { basemap : "streets", extent : extentInitial, lods : myLods, showAttribution: false, }); mapMain.on("click", addStop); routeTask = new RouteTask("https://ags2.scgov.net/arcgis/rest/services/ScOperational/RoutingService/NAServer/Route"); routeParams = new RouteParameters(); routeParams.attributeParameterValues = [{attributeName: "Oneway", parameterName: "Restriction Usage", value: "Prohibited"}, {attributeName: "RestrictedTurns", parameterName: "Restriction Usage", value: "Prohibited"}]; routeParams.outSpatialReference = mapMain.SpatialReference; routeParams.returnRoutes = true; routeParams.returnStops = true; routeParams.returnDirections = true; routeParams.directionsLengthUnits = Units.MILES; routeParams.impedanceAttribute="Length"; routeParams.stops = new FeatureSet(); routeTask.on("solve-complete", showRoute); routeTask.on("error", errorHandler); function addStop(evt) { stopSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CROSS, 20, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([89, 95, 35]), 2 ), new Color([130, 159, 83, 0.40]) ); var stop = new Graphic(evt.mapPoint, stopSymbol); mapMain.graphics.add(stop); routeParams.stops.features.push(stop); if (routeParams.stops.features.length >= 2) { routeTask.solve(routeParams); lastStop = routeParams.stops.features.splice(0, 1)[0]; //what does? } console.log(lastStop); } function showRoute(solveResult) { routeSymbol = new SimpleLineSymbol(SimpleLineSymbol.STYLE_DASH, new Color([254, 0, 0]), 3); mapMain.graphics.add(solveResult.routeResults[0].route.setSymbol(routeSymbol)); } function errorHandler(err) { alert("An error occured\n" + err.message + "\n" + err.details.join("\n")); routeParams.stops.features.splice(0, 0, lastStop); mapMain.graphics.remove(routeParams.stops.features.splice(1, 1)[0]); } }); }); Thanks David
... View more
10-14-2013
11:13 AM
|
0
|
4
|
3569
|
|
POST
|
Hi all- For those that are interested, it would appear that the parseOnLoad option must be set within the dojoConfig section when configured for asynchronous module loading in your index.html at 3.7: <script> var dojoConfig = { async : true, parseOnLoad : true }; </script> As such, I would consider this thread answered David
... View more
10-04-2013
11:23 AM
|
0
|
0
|
1208
|
|
POST
|
Hi all, I'm noticing an exent shift upon map load event at the 3.7 api that was not present at the 3.6 api. For example, the exent: var extentWM = new Extent({ "xmin": -9223319.21340548, "ymin": 3108650.4632008513, "xmax": -9102472.271686783, "ymax": 3178361.032996838, "spatialReference" : { "wkid" : 102100 } }); seems to shift my map some 40 km south of where it should be on load. A tiled and dynamic map service are both configured as web mercator. If anyone has any ideas, that would be great. Thanks, David
... View more
10-03-2013
11:12 AM
|
0
|
3
|
1421
|
|
POST
|
Hi Jeff- Last week I was testing, getting funny results with my Extent vars in 3.7, haven't been able to figure it out yet. So while I didn't think the api was broken, nor did I try to download it, I couldn't figure out the shift I was seeing in my 3857 wkid at 3.7 David
... View more
10-01-2013
11:33 AM
|
0
|
0
|
3062
|
|
POST
|
Hi Jeff- I'm working with a FeatureLayer for Sarasota County Evacuation Zones app, and am curious about the maxAllowableOffset parameter at 3.6. I'm having some performance issues with the surge layer, and I believe that at 3.6 this value is auto-calculated upon an extent change. Is there a better way to set it explicitly? Thanks David
... View more
09-13-2013
09:23 AM
|
0
|
0
|
1243
|
|
POST
|
Yes, yes, yes, well described . . . and thanks again. I'll let you get back to your 3.4 changes 🙂
... View more
07-11-2013
10:13 AM
|
0
|
0
|
2526
|
|
POST
|
Thanks Robert, works like a charm. Let's see, if I'm following the programming logic correctly, the original variable typeID string in the layerDetails if block is set to return the attributes of any given field and when employed on a subtype field or codedDomain field the reutrn will be descriptions as designed. But when both subtypes and coded val domains descriptis are to be returned, the typeID has to essentially be cleared first, then set to return the decripts and not the codes... Anyway, hope I haven't embarrased myself to badly here, please feel free to correct me and it's always a pleasure working with you. I'll shoot you a url when I put up a release build-- Thanks Again- David
... View more
07-11-2013
08:57 AM
|
0
|
0
|
2526
|
|
POST
|
Hi Robert- Thanks for the reply. Yeah, For us here in southwest Florida, hurricane season preparations tends to backlog my update frequency. Yes I am using the source code version if I understand you correctly, although I typically download from the eSearch.zip Code Attachement download section, and not from github. I'll be updating to 3.4 very shortly, and so wasn't going to spend alot of time on this, unless you had something already forked on github for this version, or had could direct me to a particular function in the mxml.
... View more
07-11-2013
06:54 AM
|
0
|
0
|
2526
|
|
POST
|
Hey Robert, sure thing. I am going to go ahead and un-secure this service: https://ags2.scgov.net/arcgis/rest/services/ScOperational/SCDataAgol/MapServer and then let's work with the Parks layer at: https://ags2.scgov.net/arcgis/rest/services/ScOperational/SCDataAgol/MapServer/25 If that's ok with you. I can leave it unsecure throughout the day oon 7/11/2013 The subtype field is 'ParkType', the 'PublicAccess' field has the coded domain values. I am not utilizing the coded domain field as as a search, but am returning its values. Perhaps it is the fact that these domain values are inherited? Thanks, looking forward to your reply-- Here is my full layer xml section for this layer: <layer> <token/> <useproxy>false</useproxy> <definitionexpression></definitionexpression> <enableprintgrid title="Selected Parks">true</enableprintgrid> <enableexport>true</enableexport> <name>Sarasota County Parks</name> <url>https://ags2.scgov.net/arcgis/rest/services/ScOperational/SCDataAgol/MapServer/25</url> <expressions> <expression alias="Park Type" textsearchlabel="Search by Park Type:" isvaluerequired="false"> <values> <value prompt="Example: Natural Area Park" field="ParkType" usesubtype="true">ParkType = [value]</value> </values> </expression> <expression alias="Park Name" textsearchlabel="Search by Park Name:" isvaluerequired="true"> <values> <value prompt="Example: Nathen Benderson Park" uniquevalsfromfield="ParkName">ParkName = '[value]'</value> </values> </expression> </expressions> <graphicalsearchlabel>Use one of the graphical search tools to select Parks</graphicalsearchlabel> <spatialsearchlayer>false</spatialsearchlayer> <titlefield>ParkType</titlefield> <fields all="false"> <field name="ParkType" alias="Park Type" gridfield="true" /> <field name="ParkName" alias="Park Name" gridfield="true" /> <field name="Address" alias="Address" gridfield="true" /> <field name="Phone" alias="Phone Number" gridfield="true" /> <field name="PublicAccess" alias="Public Access" gridfield="true"/> </fields> <!--<links></links>--> <zoomscale usegeometry="true" zoompercent="1.6" /> <autoopendatagrid>true</autoopendatagrid> <relates> <relate id="2" label="Parks Information" enableexport="true" icon="assets/images/i_table.png"> <fields all="false"> <field name="ADA_Access" alias="Is ADA Accessible" /> <field name="Concession" alias="Has Concesssions" /> <field name="Restrooms" alias="Has Restrooms" /> <field name="Showers" alias="Has Showers" /> <field name="Playgrounds" alias="Has Playgrounds" /> <field name="AthleticCourts" alias="Has Courts" /> <field name="AthleticFields" alias="Has Ball Fields" /> <filed name="CanoeKayakLaunch" alias="Has Kayak Launch" /> <field name="BoatAccess" alias="Has Boat Access" /> <field name="PicnicArea" alias="Has Picnic Areas" /> <field name="CampingArea" alias="Has Camping" /> </fields> </relate> </relates> </layer>
... View more
07-10-2013
12:56 PM
|
0
|
0
|
2526
|
|
POST
|
Hi Robert- I aplogize for potentially being in the wrong thread. I was wondering if you had any difficulites in displaying coded values in either the primary feature class or related table when using the Enhanched Search Widget: Version: 3.2.1 Build Date: 4/1/2013 I seem to be having difficulty displaying domain descriptions in fields that use coded value domains when I am also utililizing the usesubtype="true" setting. Any insight is appreciated and btw nice meeting you at the Dev Conference in March this year thanks David Coley Sarasota County GIS Sarasota County, FL
... View more
07-09-2013
12:42 PM
|
0
|
0
|
3776
|
|
POST
|
Actually, no. I don't think the absence or precence of a global ID on the AOI layer should affect data access or tile worker processes. But different index types could (ie sql geometry spatial indices vs an FDO_index in a file gdb). So after my original reply it occured to me that since the caching errors are occuring when using an area of interest, and for the first time I am seeing a TileWorker error along with an index error, I believe that different index types are not being handled by the Tile Worker process. So potential solution then: Either place all data to be cached in an fdgb, including the AOI poly; OR place the AOI poly in sde in sde as well, where it can utilize the same type and size of spatial index. This was never a problem for us when using Arc Binary storage type, but since we moved to Sql Geometry apparently it is. Thanks David
... View more
07-01-2013
09:06 AM
|
0
|
0
|
2383
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 1 | 3 weeks ago | |
| 6 | 4 weeks ago | |
| 1 | 06-17-2026 06:04 AM | |
| 1 | 06-08-2026 08:37 AM |
| Online Status |
Online
|
| Date Last Visited |
5 hours ago
|