mark@4qtrs.net

What is the recommend way to create my Picture Marker?

Discussion created by mark@4qtrs.net on Mar 14, 2011
Latest reply on Apr 27, 2011 by flexcope
Hello,

I am creating a graphic layer that contains locations of several vehicles. We are using different images to differentiate vehicle types and would like render a circle/ball behind the image with a background color that is set programatically. (Using different colors to indicate a status). I have attached a picture of what I would like to do. (view pic) Right now all I am displaying is just the image with no circle/ball behind it. My questions is .... what is the best/recommend way to create the marker?

Here is the code I am using to create my current picture marker....
AGSPictureMarkerSymbol *myMarkerSymbol = [AGSPictureMarkerSymbol 
             pictureMarkerSymbolWithImage:[UIImage imageNamed:@"taxi.png"]]; 
 myMarkerSymbol.size = _defaultPinSize;
 
 //Create a dictionary w/ our pin attributes.
 NSArray *keys = [NSArray arrayWithObjects:@"UNITID", @"STATUS", nil];
 NSArray *objects = [NSArray arrayWithObjects:item.unitId, item.status, nil];
 NSDictionary *pindetails = [NSDictionary dictionaryWithObjects:objects forKeys:keys];
 
 //Create an AGSPoint (which inherits from AGSGeometry) that
 //defines where the Graphic will be drawn
 AGSPoint* myMarkerPoint =
 [AGSPoint pointWithX:item.longitude
        y:item.latitude
  spatialReference:self.mapView.spatialReference];
 
 [self UpateMaxMin:item.latitude longitude:item.longitude];
 
 //Create the Graphic, using the symbol and
 //geometry created earlier
 AGSGraphic *myGraphic = [AGSGraphic 
        graphicWithGeometry:myMarkerPoint 
        symbol:myMarkerSymbol 
        attributes:pindetails 
        infoTemplateDelegate:unitTemplate];
 
 [self.unitsLayer addGraphic:myGraphic];


I have tried creating SimpleFill and SimpleMarker symbols but was not able to figure out to render my image on top of them or add the image to the symbol. Is it a bad idea to try and add two separate symbols (one simple marker and other image picture marker) at the same coordinates to try and achieve the desired result? It seems like there is probably a better way to do this.. any ideas would be appreciated.

Thanks,
Mark

Outcomes