Skip to content

Instantly share code, notes, and snippets.

@jgravois
Last active January 13, 2016 18:59
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jgravois/8404339 to your computer and use it in GitHub Desktop.
Save jgravois/8404339 to your computer and use it in GitHub Desktop.
this is a gist to remind john and matt how to query for the maximum value in a field manually (since the JS api doesnt have any tools to limit query results)
use outStatistics
http://services.arcgis.com/OfH668nDRN7tbJh0/arcgis/rest/services/My_Walks/FeatureServer/0/query?where=1%3D1&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&geohash=&inSR=&spatialRel=esriSpatialRelIntersects&distance=&units=esriSRUnit_Meter&outFields=&returnGeometry=false&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnDistinctValues=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=%5B%7B%0D%0A++++%22statisticType%22%3A+%22max%22%2C%0D%0A++++%22onStatisticField%22%3A+%22WHEN%22%0D%0A%7D%5D&resultOffset=&resultRecordCount=&returnZ=false&returnM=false&quantizationParameters=&f=pjson&token=
// not the old hack you used with driskull
FIELD=(SELECT MAX(FIELD) FROM TABLE)
http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/3/query?where=POP2007=(SELECT MAX(POP2007) FROM states)&text=&objectIds=&time=&geometry=&geometryType=esriGeometryEnvelope&inSR=&spatialRel=esriSpatialRelIntersects&relationParam=&outFields=&returnGeometry=true&maxAllowableOffset=&geometryPrecision=&outSR=&returnIdsOnly=false&returnCountOnly=false&orderByFields=&groupByFieldsForStatistics=&outStatistics=&returnZ=false&returnM=false&gdbVersion=&returnDistinctValues=false&f=html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment