Select to view content in your preferred language

Graphic Layer not Showing up

1524
8
06-24-2011 07:16 AM
TimothyWilcoxon
Emerging Contributor
http://help.arcgis.com/en/webapi/javascript/arcgis/demos/graphics/graphics_extent_query.html

I took this code above and inserted our data into it and it will not populate a graphic
This is all I changed

var queryTask = new esri.tasks.QueryTask("http://1XX.XX.XXX.XXX/ArcGIS/rest/services/Lone/Parcels/MapServer/0");
        var query = new esri.tasks.Query();

        query.outSpatialReference = {wkid:102100};
        query.returnGeometry = true;
        query.outFields = ["*"];
        queryTask.execute(query, addPointsToMap);

Any ideas on why it won't produce a graphic or layer on the map?
0 Kudos
8 Replies
KellyHutchins
Esri Notable Contributor
Tim,

If you set a breakpoint (using firebug or chrome's developer tools) in addPointsToMap you can check to see if results are returned.

One thing you might want to check is this sample is setup to draw points so it defines symbology for point features. Your query task looks like its a parcel layer which probably contains polygons. You'll want to change the symbols below to be SimpleFillSymbols to draw polygon features.

defaultSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([0,0,255]));

highlightSymbol = new esri.symbol.SimpleMarkerSymbol().setColor(new dojo.Color([255,0,0]));
0 Kudos
TimothyWilcoxon
Emerging Contributor
you are right, that was a bad example but I did have the same problem with point features.
I used chrome developer tool and it come up with the

http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.3
serverapi.arcgisonline.com:14Error
Line 14 is where the whole function is.
I am not sure what that means.
0 Kudos
StephenLead
Honored Contributor
Tim,

Your code fragment doesn't show a WHERE clause in the query - could that be the problem? See the example you linked to, which contains

query.where = "STATE_NAME = 'Washington'";


Does your code have a similar statement? If so, can you post your entire code so we can see more info?

Steve
0 Kudos
TimothyWilcoxon
Emerging Contributor
Is the query.where cause necessary?
I want the whole layer to be displayed. is there a querywhere cause for that?
0 Kudos
derekswingley1
Deactivated User
Use query.where = '1=1';
0 Kudos
TimothyWilcoxon
Emerging Contributor
On one of my layers the query.where = '1=1'; only populates 3/4 of my data? what would cause that?
0 Kudos
derekswingley1
Deactivated User
Map services will only return 500 records (9.3.1) or 1000 records (10.0) out of the box. Is it possible you're hitting this limit?
0 Kudos
StephenLead
Honored Contributor
If you're displaying all features, it might make more sense to use a featureLayer?
0 Kudos