<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: JSON from REST query to object in JS in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834086#M8588</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that - that query is similar to what i used to get the JSON attached to my op. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at the source (using firebug in FF) i have been unable to find any geometry data associated with any layers displayed in the map. I have only been able to find div tags which display an image and change when the layers are changed. They're published to our dev server as MapServices and then have been added to My Content in AGOL and then included in the WebMap which is being used by the WebApp Builder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once i had the geometry of the depots and user specified locations I was going to pass these into a NA Service hosted on our dev server.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 25 Jun 2015 01:03:20 GMT</pubDate>
    <dc:creator>HamishKingsbury1</dc:creator>
    <dc:date>2015-06-25T01:03:20Z</dc:date>
    <item>
      <title>JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834079#M8581</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;What I'm trying to do is (using WebApp Builder) is to see how a point placed on the map is from the closet vehicle depot. I can get the geometry of the point being placed on the map easily but I can't figure out how to get the geometry of the depot. This is being down through a custom WebApp Builder widget.&lt;/P&gt;&lt;P&gt;What I am trying to do is using a query from the REST endpoint is create an object (that is not displayed on the map) with the geometry (location) and name for all the depots. I will then use the point placed on the map and the object from the JSON query to plug into a closest facility service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Attached is a copy of the JSON returned when I put the query URL into the web browser.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help will be really appreciated&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 20:57:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834079#M8581</guid>
      <dc:creator>HamishKingsbury1</dc:creator>
      <dc:date>2015-06-24T20:57:59Z</dc:date>
    </item>
    <item>
      <title>Re: JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834080#M8582</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hamish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; So what is it that you need from this json? What are the required inputs for the closest facility service?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 21:10:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834080#M8582</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2015-06-24T21:10:07Z</dc:date>
    </item>
    <item>
      <title>Re: JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834081#M8583</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm not 100% sure but I'm guessing it will be a point object with a geometry &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 22:10:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834081#M8583</guid>
      <dc:creator>HamishKingsbury1</dc:creator>
      <dc:date>2015-06-24T22:10:54Z</dc:date>
    </item>
    <item>
      <title>Re: JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834082#M8584</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Hamish,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Your post is a little tricky to decipher. Are you able to confirm the following:&lt;/P&gt;&lt;OL style="list-style-type: decimal;"&gt;&lt;LI&gt;Are you wanting to find the nearest location by driving distance (routing) or as the crow flies (Euclidean)&lt;/LI&gt;&lt;LI&gt;You have access to a location (point) that the user will click on the map&lt;/LI&gt;&lt;LI&gt;You have access to a map/feature service that has the location of all the depots&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I can get some clarification I might be able to help you a little bit more.&lt;/P&gt;&lt;P&gt;Or you can message me privately and we can chat on the phone.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 22:46:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834082#M8584</guid>
      <dc:creator>SamDrummond2</dc:creator>
      <dc:date>2015-06-24T22:46:16Z</dc:date>
    </item>
    <item>
      <title>Re: JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834083#M8585</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry! wrote it in a bit of rush.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Driving distance - have a service published to our server&lt;/P&gt;&lt;P&gt;2. I can access the geometry ect for the point on the map&lt;/P&gt;&lt;P&gt;3. I have access to a map service with the depot locations&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I was initially using CMV and had no issues, but the client wanted it done in WebApp Builder and because it's using a WebMap from AGOL the layers are being shown as images not features with geometry. I could load the layers and not display them but I though doing it (getting the depot locations) with JSON would be quicker as it has less overhead(?).&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 23:05:17 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834083#M8585</guid>
      <dc:creator>HamishKingsbury1</dc:creator>
      <dc:date>2015-06-24T23:05:17Z</dc:date>
    </item>
    <item>
      <title>Re: JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834084#M8586</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Okay, that makes sense so far - with one exception. You said "&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;because it's using a WebMap from AGOL the layers are being shown as images not features with geometry" - the webmap doesn't define whether its an image or a feature. Do you mean that you are using a tiled service in the webmap?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;However, more to the point once you have the depot points how do you intend to get the closest facility?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: arial, helvetica, 'helvetica neue', verdana, sans-serif;"&gt;Sam&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 23:43:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834084#M8586</guid>
      <dc:creator>SamDrummond2</dc:creator>
      <dc:date>2015-06-24T23:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834085#M8587</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;However, if you want to get the point features from the facilities feature service you could probably do a query like the one below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[servername]/arcgis/rest/services/[mapservicename]/MapServer/[layerIndex]/query?where=objectid&amp;gt;1&amp;amp;text=&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry=&amp;amp;geometryType=esriGeometryEnvelope&amp;amp;inSR=&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;relationParam=&amp;amp;outFields=*&amp;amp;returnGeometry=true&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=&amp;amp;returnIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;gdbVersion=&amp;amp;returnDistinctValues=false&amp;amp;f=json&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This simply asks for all the features with an ObjectID &amp;gt; 0 and asks for all fields to be returned ('*'). You could be specific about which fields you want returned. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to see the REST form for creating the query you could just change the 'f' parameter to equal 'html' so:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[servername]/arcgis/rest/services/[mapservicename]/MapServer/[layerIndex]/query?where=objectid&amp;gt;1&amp;amp;text=&amp;amp;objectIds=&amp;amp;time=&amp;amp;geometry=&amp;amp;geometryType=esriGeometryEnvelope&amp;amp;inSR=&amp;amp;spatialRel=esriSpatialRelIntersects&amp;amp;relationParam=&amp;amp;outFields=*&amp;amp;returnGeometry=true&amp;amp;maxAllowableOffset=&amp;amp;geometryPrecision=&amp;amp;outSR=&amp;amp;returnIdsOnly=false&amp;amp;returnCountOnly=false&amp;amp;orderByFields=&amp;amp;groupByFieldsForStatistics=&amp;amp;outStatistics=&amp;amp;returnZ=false&amp;amp;returnM=false&amp;amp;gdbVersion=&amp;amp;returnDistinctValues=false&amp;amp;f=html&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 Jun 2015 23:57:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834085#M8587</guid>
      <dc:creator>SamDrummond2</dc:creator>
      <dc:date>2015-06-24T23:57:01Z</dc:date>
    </item>
    <item>
      <title>Re: JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834086#M8588</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for that - that query is similar to what i used to get the JSON attached to my op. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Looking at the source (using firebug in FF) i have been unable to find any geometry data associated with any layers displayed in the map. I have only been able to find div tags which display an image and change when the layers are changed. They're published to our dev server as MapServices and then have been added to My Content in AGOL and then included in the WebMap which is being used by the WebApp Builder.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Once i had the geometry of the depots and user specified locations I was going to pass these into a NA Service hosted on our dev server.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2015 01:03:20 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834086#M8588</guid>
      <dc:creator>HamishKingsbury1</dc:creator>
      <dc:date>2015-06-25T01:03:20Z</dc:date>
    </item>
    <item>
      <title>Re: JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834087#M8589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm pretty sure that I understand what you are thinking now. That approach sounds reasonable providing you don't have many facilities. The limitation is that every time you want to find the nearest route you will be passing the clicked location + all the facility features to the server each time as parameters. This is potentially really inefficient. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An alternative option might be to create a geoprocessing service which:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- Accepts a point as an input parameter&lt;/P&gt;&lt;P&gt;- Does all the routing and finds the nearest facility based on the source data server side&lt;/P&gt;&lt;P&gt;- returns the nearest facility as a point feature&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Make sense?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sam&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2015 01:32:19 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834087#M8589</guid>
      <dc:creator>SamDrummond2</dc:creator>
      <dc:date>2015-06-25T01:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: JSON from REST query to object in JS</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834088#M8590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;There will be 4 facilities and no more than (in the worst case) 8 or 9 incidents&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 25 Jun 2015 01:50:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/json-from-rest-query-to-object-in-js/m-p/834088#M8590</guid>
      <dc:creator>HamishKingsbury1</dc:creator>
      <dc:date>2015-06-25T01:50:26Z</dc:date>
    </item>
  </channel>
</rss>

