Select to view content in your preferred language

Feature layer not getting drawn during a centerAndZoom

914
4
01-24-2012 09:01 AM
DougCollins
Regular Contributor
Greetings,

I have an application with 1 ArcGISTiledMapServiceLayer as the base layer and 1 ArcGISDynamicMapServiceLayer (feature layer) with points as the features.  I have a JavaScript function that centers on a particular point and zooms to that point (i.e. map.centerAndZoom(centerPt, zoomLevel) ). 

If the zoomLevel changes from one point to the next, then the points do not show up until I move the map a bit to change the extent a bit.  I have tried using layer.hide() and layer.show() but the points still do not display until I move the map a bit.

Does anyone know of a way to refresh the feature layer so that the points will display?
Any help with this is greatly appreciated.  I have run out of ideas!
It seems that there should be a refresh event in the API that would accomplish the same thing as physically moving the map.

Thanks,
Charlie
0 Kudos
4 Replies
DougCollins
Regular Contributor
After looking through the forums I have come across similar posts, such as:
http://forums.arcgis.com/threads/3980-centerAndZoom-is-still-not-work-in-2.0?highlight=centerAndZoom


It appears that this problem still exists when you have both a TiledMapService and a DynamicMapService.

This is a show stopper.

Charlie
0 Kudos
derekswingley1
Deactivated User
Hi Charlie,

If you're an ArcGISDynamicMapServiceLayer, that's not what we call a feature layer.

Can you provide a repro of this issue?
0 Kudos
DougCollins
Regular Contributor
After searching back a couple of years through the forums, I finally found an answer for my problem.  When defining a centerPoint for the centerAndZoom method, you must assign a SpatialReference to the centerPoint.  Typically you define a SpatialReference for the Extent when setting up for this method, but it was not clear from the documentation that a SpatialReference must also be assigned to the centerPoint.

Thanks,
Charlie
0 Kudos
derekswingley1
Deactivated User
It's implied that the mapPoint parameter for centerAndZoom needs a spatial reference as it links to the doc for esri.geometry.Point. SpatialReference for the point class is documented as required.

Anyway, glad you got it figured out!
0 Kudos