Select to view content in your preferred language

Marker Placement

1130
1
10-03-2011 09:28 AM
SamerToukan
Emerging Contributor
Hello,

I have been trying to place a single marker onto a point of which I have the google, latitude/longitude of. I do so with the following code,

var myGraphicMarker:Graphic = new Graphic(new MapPoint(-120.0, 54.3,new SpatialReference(4326)), 
  new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 44, 0x009933));
  myGraphicMarker.toolTip = "Marker added with ActionScript";
  myGraphicsLayer.add(myGraphicMarker);


The SpatialReference(4326) is Lat/Long. However I have 3 problems I cannot seem to overcome.

1. The location of the marker is incorrect. It is appearing to stay on WebMercator.
I have looked over some other samples such as WebMercatorUtil where it converts the co-ords. How can I use this  for the follow:
Input Lat/Long - > WebMercatorUtil - > X, Y -> MapPoint(X,Y)

2. Any Examples of how I can make a custom marker using actionscript and Popup Window using actionscript on click of marker?

Cheers!
Samer
Tags (2)
0 Kudos
1 Reply
SamerToukan
Emerging Contributor
Solution to Part 1.

var myGraphic:Graphic = new Graphic();
 var wgs:SpatialReference = new SpatialReference(4326);
 {
  var test= new MapPoint(-122,47.40,wgs);
  myGraphic.geometry = WebMercatorUtil.geographicToWebMercator(test);
  
  myGraphic = new Graphic(myGraphic.geometry,
  new SimpleMarkerSymbol(SimpleMarkerSymbol.STYLE_CIRCLE, 22, 0x009933));
  myGraphic.toolTip = "Marker added with ActionScript";
  myGraphicsLayer.add(myGraphic);
 }
0 Kudos