Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I am trying to access the fields which I can see in this particular layer. I am able to see that it has fields but fetching the values in those fields is something that I am unable to do. Is there someway to do that?

share|improve this question
add comment

3 Answers

up vote 2 down vote accepted

Just use the REST interface 'Query', scroll to bottom of page that you gave, here is a query for OBJECTID > 0, shows 98 records.

Where field: OBJECTID > 0
Outfields: *

http://sampleserver6.arcgisonline.com/arcgis/rest/services/911CallsHotspot/MapServer/jobs/jef3fd04155ce410386cc7f64ebad694d/0/query?where=OBJECTID+%3E+0&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

In javascript, do something like this...

    var selectQuery = new esri.tasks.Query();
    selectQuery.where = "OBJECTID > 0";
    selectQuery.outFields = ["*"];
    var queryTask = new esri.tasks.QueryTask("http://sampleserver6.arcgisonline.com/arcgis/rest/services/911CallsHotspot/MapServer/jobs/jef3fd04155ce410386cc7f64ebad694d");
    queryTask.execute(selectQuery, function (features) {
        //do something with features returned
    });
share|improve this answer
    
what is it that I need to enter for the query? query in queryTask.selectQuery(query, function (features) {//code here}); –  Sam007 Nov 19 '12 at 22:12
1  
edited above: queryTask.execute(selectQuery, function(... –  awesomo Nov 19 '12 at 23:18
    
is it possible to replicate the same Map Service in arcserver 10.03? I am trying to fetch the layer info like the example link you posted but it returns an error on ArcServer 10 –  Sam007 Nov 30 '12 at 16:30
    
Not sure what you mean about replicating. However, this sample service in question is actually paired with a geoprocessing service. The map service is the result of the geoprocessing service. You use a jobID to access it. It is deleted by defaut in 6 hours. Check out help here resources.arcgis.com/en/help/main/10.1/index.html#/… –  awesomo Nov 30 '12 at 21:17
    
exactly this is on 10.1 but I am not able to create the same in 10. When I try to access the map server created by geoprocessing service in 10 it gives an error. –  Sam007 Nov 30 '12 at 22:16
add comment

Scoll to the bottom of the page you gave and click "Query". To return all features in the layer, enter "0=0" in the top text box (labeled "Where:"). "0=0" is a true condition for all features. Leave all the other text boxes blank and press the "Query (GET)" button at the bottom of the form.

I recommend the JavaScript answer from awesomo, but if you want to only get certain fields, replace the "*" in

    selectQuery.outFields = ["*"];

with the field headings you want to work with. If you only want to return CALL_TYPE, CITY, and Date, the JavaScript would be

    selectQuery.outFields = ["CALL_TYPE", "CITY", "Date"];
share|improve this answer
add comment

Did you try to get objects from this particular layer?

Your layer has /query endpoint, where you can query for objects on your layer Layer 0: Query

On this layer there is 98 objects. One sample object is OBJECTID:6

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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