Select to view content in your preferred language

DrawWidget spatialReference for lastDrawnGraphic

745
2
Jump to solution
08-28-2012 11:04 PM
AndrewIosida
Emerging Contributor
Hello!
At the end of drawing in drawWidget in the function activateDrawTool(event : MouseEvent) I have a code
setMapAction(drawType, drawStatus, null, map_drawEndHandler);


Then works function map_drawEndHandler(event : DrawEvent)
var geom:Geometry = event.graphic.geometry;    lastDrawnGraphic = new Graphic(geom); graphicsLayer.add(lastDrawnGraphic);

I have several layers in my project with different spatialReference. And I'd like to add graphic element with spatialReference of the layer, not the map. But event in function map_drawEndHandler(event:DrawEvent) already had spatialReference and coordinatesSystem of basemaps_layer in my config.xml. And lastDrawnGraphic will have coordinates according to basemaps_layer.
Thanks in advance. And sorry for my bad english.
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Andrew,

   The issue is that this line calls a function in the MapManager.mxml

setMapAction(drawType, drawStatus, null, map_drawEndHandler);

Which uses the DrawTool which will always draw in the same spatial reference as the map. So no matter what you will have to reproject the returned graphic to your desired spatial reference.


Also you need to post Flex Viewer /Widget questions to the Flex Viewer forum:

http://forums.arcgis.com/forums/111-ArcGIS-Viewer-for-Flex

This is the Flex API forum.

View solution in original post

0 Kudos
2 Replies
RobertScheitlin__GISP
MVP Emeritus
Andrew,

   The issue is that this line calls a function in the MapManager.mxml

setMapAction(drawType, drawStatus, null, map_drawEndHandler);

Which uses the DrawTool which will always draw in the same spatial reference as the map. So no matter what you will have to reproject the returned graphic to your desired spatial reference.


Also you need to post Flex Viewer /Widget questions to the Flex Viewer forum:

http://forums.arcgis.com/forums/111-ArcGIS-Viewer-for-Flex

This is the Flex API forum.
0 Kudos
AndrewIosida
Emerging Contributor
Thank you, Robert.
0 Kudos