How to query nearest date (today) in ArcGIS Server REST?


ID    NAME            DATA
1     test           2013-06-01 13:00:00
2     test1          2013-06-01 16:00:00
3     test2          2013-07-01 18:00:00

Expected result : query ID = 3

  • Are you interacting directly with the REST api, or using another API such as the ArcGIS Server Javascript API? – Stephen Lead Nov 22 '13 at 19:00
  • Directly with the REST api – user7172 Nov 22 '13 at 19:34
  • What is the underlying database (Oracle/MSSQL/FileGDB/... etc.)? – Petr Krebs Nov 22 '13 at 21:12
  • I use Oracl/Postgres. – user7172 Nov 24 '13 at 9:25

This answer might not be the final solution, but I can provide some ideas about this question.

First, switch the Date to time format, according to: http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Query_Map_Service_Dynamic_Layer/02r3000000z6000000/ (Parameter 'time')

Then compare all the time data and pick the biggest number by using the max statisticType:

http://resources.arcgis.com/en/help/arcgis-rest-api/index.html#/Query_Map_Service_Dynamic_Layer/02r3000000z6000000/ (Parameter 'outStatistics')

outStatistics is supported on only those layers/tables that indicate suppportsStatistics is true.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.