Select to view content in your preferred language

Points not displaying when ON_DEMAND mode is used

1052
8
07-18-2011 02:36 AM
GavinTrowles
Emerging Contributor
Hi

I am using ON_DEMAND mode to display features on a map as with the following example (http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples_start.htm). When pointing the code at an exisiting layer that has been set up all points show up fine and everything looks as it should. However as soon as I change my code to point at a newly created layer only one point is returned (I have checked the rest service and there should be over 700 points). No other changes have been made to the code.

Do layers have to be set up in a specific way to allow for the use of ON_DEMAND as given what I have explained above Im assuming the issue lies with the layer and not my code.

Has anyone else come across this issue.
0 Kudos
8 Replies
StephenLead
Honored Contributor
Hi Gavin,

Does your point layer display correctly in snapshot mode? What about as a Dynamic layer?

Could there be a scale dependency which is preventing the points from showing? Look for the Min. Scale: and Max. Scale: values in the REST services directory (eg here)

Steve
0 Kudos
derekswingley1
Deactivated User
Do you see any messages in the Firefox or Chrome JavaScript console when you load the layer? Does this layer have a visible ObjectID field? Specifically, do you see an ObjectID field when you look at the layer via the services directory?

Any chance you can provide a link to your services directory and/or your app?
0 Kudos
GavinTrowles
Emerging Contributor
Hi Gavin,

Does your point layer display correctly in snapshot mode? What about as a Dynamic layer?

Could there be a scale dependency which is preventing the points from showing? Look for the Min. Scale: and Max. Scale: values in the REST services directory (eg here)

Steve


Hi

The layer does not display in snapshot mode correctly but does when using the dynamic layer method. Scales have been set but Im making sure Im at the correct scale and only one point ever shows up.
0 Kudos
GavinTrowles
Emerging Contributor
Do you see any messages in the Firefox or Chrome JavaScript console when you load the layer? Does this layer have a visible ObjectID field? Specifically, do you see an ObjectID field when you look at the layer via the services directory?

Any chance you can provide a link to your services directory and/or your app?


Hi

The rest service is not public facing and nor is the app so I cannot provide a link. However I have noticed that the rest service does not have a field called

-ESRI_OID (Type: esriFieldTypeOID, Alias: ESRI_OID)

which is present in a layer which does work with ON_DEMAND MODE. The current layer I'm using only holds the following fields

ID (Type: esriFieldTypeInteger, Alias: ID)
AreaNo (Type: esriFieldTypeInteger, Alias: AreaNo)
Year (Type: esriFieldTypeInteger, Alias: Year)
CounterSite (Type: esriFieldTypeInteger, Alias: CounterSite)
Easting (Type: esriFieldTypeInteger, Alias: Easting)
Northing (Type: esriFieldTypeInteger, Alias: Northing)
AADTInfo (Type: esriFieldTypeString, Alias: AADTInfo, Length: 2000 )
AWTInfo (Type: esriFieldTypeString, Alias: AWTInfo, Length: 2000 )
SiteSelect (Type: esriFieldTypeString, Alias: SiteSelect, Length: 2000 )
Shape (Type: esriFieldTypeGeometry, Alias: Shape)

Could this be the reason why and if so how can I ensure that this field is present.

Thanks

Edit full list of fields within the layer that does work in on demand mode

AccidentID (Type: esriFieldTypeInteger, Alias: AccidentID)
AccidentRef (Type: esriFieldTypeString, Alias: AccidentRef, Length: 10 )
NoOfVehicles (Type: esriFieldTypeInteger, Alias: NoOfVehicles)
NoOfCasualties (Type: esriFieldTypeInteger, Alias: NoOfCasualties)
AccidentDateTime (Type: esriFieldTypeDate, Alias: AccidentDateTime, Length: 36 )
LocalAuthority (Type: esriFieldTypeString, Alias: LocalAuthority, Length: 200 )
FirstRoadClass (Type: esriFieldTypeString, Alias: FirstRoadClass, Length: 200 )
FirstRoadNo (Type: esriFieldTypeInteger, Alias: FirstRoadNo)
RoadType (Type: esriFieldTypeString, Alias: RoadType, Length: 200 )
Geometry (Type: esriFieldTypeGeometry, Alias: Geometry)
SpeedLimit (Type: esriFieldTypeInteger, Alias: SpeedLimit)
GeometryString (Type: esriFieldTypeString, Alias: GeometryString, Length: 2147483647 )
InspectionDate (Type: esriFieldTypeString, Alias: InspectionDate, Length: 25 )
InspectionTime (Type: esriFieldTypeString, Alias: InspectionTime, Length: 25 )
AccidentSeverityID (Type: esriFieldTypeInteger, Alias: AccidentSeverityID)
PoliceForceID (Type: esriFieldTypeInteger, Alias: PoliceForceID)
ESRI_OID (Type: esriFieldTypeOID, Alias: ESRI_OID)
0 Kudos
derekswingley1
Deactivated User
Yes, your feature layer needs an OID field. Do you see a message about this in the firebug or chrome dev tools console?

What is the format for the underlying data?
0 Kudos
GavinTrowles
Emerging Contributor
Yes, your feature layer needs an OID field. Do you see a message about this in the firebug or chrome dev tools console?

What is the format for the underlying data?


Hi no errors in firebug. I have also managed to find another layer the issue happens on and I believe this is a public facing service :

- http://195.171.180.22/ArcGIS/rest/services/Postbox_NW/MapServer/0

As you can, hopefully, see the data is point data and comes from a view held on a SQL Server database.

Thanks for the help.
0 Kudos
derekswingley1
Deactivated User
Technically, it's wouldn't be an error in Firebug, just a warning. What do you see in the console? Are there any messages?

Can you modify your view to include your layer's objectID?
0 Kudos
GavinTrowles
Emerging Contributor
Hi

Just checked and I get no warnings either. The layer/view was actually set up be a different department so getting the layer changed may be a slow process.

Thanks
0 Kudos