ArcGIS Online Assistant - Query JSON

3735
2
12-07-2015 09:01 PM
Andre
by
New Contributor II

Hello everyone,

I was hoping for some guidance.  This is what I would like to do:

I have a time enabled layer on AGO.  This layer, within the attribute table, has a start date and a finish date.  Using the current date I would like to display only the features that fall between the start date and finish date. In other words, if the the date range of a feature includes the current date it will be displayed.

Currently, AGO does not allow to filter based on relational elements, like the current date (please correct me if I'm wrong).   In another post a person suggests using something called ArcGIS Online Assistant.  This tool allows you to look at the JSON behind a layer. You can then enter a query into the JSON for the current date,  Once this is done you can save the layer back to ArcGIS online with the new functionality. 

The issue is I have little experience with JSON and do not know the proper syntax to write an appropriate query into the JSON.  Could someone help me out? 

Below is an example of what my JSON looks like where would I write the query and what is the syntax?

{

  "layers": [
     {
       "0": {
            "id": 0,
            "layerDefinition": {
 

                 "drawingInfo": {
                       "renderer": {
                              "type": "simple",
                              "label": "",
                              "description": "",
                              "symbol": {
                              "angle": 0,
                              "xoffset": 0,
                              "yoffset": 12,
                              "type": "esriPMS",
                              "url": "737ec596-f3ab-4-b8f4-9c952cc048d6",
                              "imageData":"iVBORw0KGgoAAAANSUhEUgAAACYAAAAzCAYAAAD7JnqGAAAetc",
                               "contentType": "image/png",
                               "width": 27.999999999999996,
                               "height": 38
                           
}
                      
}
                   
}
               
}
           
}
,

Thank you kindly

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus

Andre,

   I would have been nice if you were provided further guidance in that other thread you mentioned. I can only assume that they were speaking of adding a definitionExpression to the json. Here is a link to the WebMap Spec:

ExportWebMap specification—Documentation (10.3 and 10.3.1) | ArcGIS for Server

Hopefully you know how to setup a proper SQL expression that will satisfy your date query. Here is an example SQL Statement that queries for today minus two months (the issue is the syntax can be different depending on the back end database type):

http://stackoverflow.com/questions/5425627/sql-query-for-todays-date-minus-two-months

0 Kudos
Andre
by
New Contributor II

Hi Robert,

Thanks for responding.  I have some experience with SQL queries so it is good to know that there are some similarities. 

I'll review the resources that you've posted and hopefully get back to you with what the definitionExperssion to the json should look like.

A

0 Kudos