Select to view content in your preferred language

Refresh map or layer

18784
6
Jump to solution
01-27-2012 12:25 PM
davidracca
New Contributor
I am modifying a widget in ARCGIS Flex Viewer using Flash Builder.
As part of a ARCGIS Server Flex application I change a feature attribute of an arcsde layer using an sql (coldfusion) and that feature attribute determines how lines are colored in the operational layer as the service is generated from a single layer project (mxd) . I'm having no problem changing that attribute in the coding, I use a coldfusion sql.

If I change the attribute and then manually pan or zoom (even slightly) the color change of the line is shown, works fine.
If I use map.zoomIn that works also and the line color changes, (the modifications of the underlying sde operational layer or the service are displayed).

All I want to do is refresh the entire map as would happen with a zoom or pan but I dont want to zoom or pan, just refresh.
I'd be happy just refreshing the layer.  I only have 2 operational layers so I guess I could get one from an index of the layer list.
I read somewhere that map.refresh() doesnt work and  I need to use layer.refresh(). 

I thought this was going to be one of the most simple and basic things but I'm having real difficulties finding an example of it for some reason.

I just want to refresh the map or layer without manually panning or zooming.

David Racca
University of Delaware
Tags (2)
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
David,

   So try something like this:

map.getLayer("The name/id of your layer").refresh();

View solution in original post

0 Kudos
6 Replies
RobertScheitlin__GISP
MVP Emeritus
David,

   So try something like this:

map.getLayer("The name/id of your layer").refresh();
0 Kudos
HoriaTudosie
Frequent Contributor

I see refreshing the layer - alright, however, the feature geometry I've just changed does not show in another position until I zoom in (and out.)

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Horia,

  Since Flex is dead I assume you posted in the wrong space and you are actually talking about JS api. If that is the case and it is the 4.x API you are talking about then you need to remove the graphic from the layer and re add it to get geometry updates to show.

HoriaTudosie
Frequent Contributor

Yes, is about JsApi - but 3.x

This is the closest post I've found related to my issue.

Is not about a Graphic in a graphic layer, but the geometry of a feature.

I've found in the mean time a solution, which seems to work well:

feature._layer.suspend();
feature.geometry.update(centroid.x, centroid.y);
feature._layer.resume();

feature._layer.refresh() however does nothing!

for the graphic in the graphic layer, the suggested solution works well:

const selectedAddress = this._getMarker("selectedAddress");
selectedAddress.geometry = centroid;
this.map.graphics.refresh();

Tx, for your reply.

0 Kudos
davidracca
New Contributor
yes, that's just what I was looking for, thanks very much Mr.Scheitlin.
thanks also for all of your many post to other users that have helped in the past

dave
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Dave,

Glad you got it working. Don't forget to click the top arrow (promote) and to click the Mark as answer check as shown below:
0 Kudos