Select to view content in your preferred language

dataprovider in mxml for esri graphic layer?

799
6
11-01-2012 06:46 AM
TomRauch
Emerging Contributor
Hi, as you know datagrids and other sorts of controls in Flasbuilder can be populated using an MXML 'dataprovider' reference bound to some data object. 

I am wondering if there is a way to provide a dataprovider 'equivalent' for an esri graphics layer?  Or do graphics layers need to be populated through Action Script code, not through MXML?

Thanks, Tom
Tags (2)
0 Kudos
6 Replies
KenBuja
MVP Esteemed Contributor
The graphic layer does have the graphicProvider property. Here's an example.
0 Kudos
DasaPaddock
Esri Regular Contributor
Also see this sample that shows declaring Graphics in MXML:
http://resources.arcgis.com/en/help/flex-api/samples/index.html#/Adding_Graphics/01nq00000012000000/

Since the graphicProvider is the default MXML property for the GraphicsLayer, it's not explicitly set in the MXML above.
http://resources.arcgis.com/en/help/flex-api/apiref/com/esri/ags/layers/GraphicsLayer.html
0 Kudos
TomRauch
Emerging Contributor
Terrific!  Thanks for the responses.  I will try these out over the week-end!

Tom
0 Kudos
TomRauch
Emerging Contributor
So here's what I am trying to do: use the 'graphicProvider' datasource in MXML to access a data service object that spits out a bunch of these XML elements:

<post>
<id>2</id>
<src>nc</src>
<eqid>71786976</eqid>
<version>0</version>
<day>Thursday</day>
<date>2012-05-17</date>
<time>04:38:38</time>
<lat>38.810000</lat>
<lon>-122.829500</lon>

<magnitude>0.6</magnitude>
<depth_km>3.0</depth_km>
<depth_mi>1.9</depth_mi>
<pr_km>2</pr_km>
<pr_mi>1</pr_mi>
<NST>10</NST>
<region>Northern California</region>
</post>

I'd like to access that data service object through the graphicProvider, specifically the lat/lon from the XML to provide location information for the markers (x={lat}, y={lon}). 

is that possible?  When I associate my data object reference to graphicProvider, I get an error - trying to coerce a valueObject that is not supported by GraphicLayer.

Thanks for any help/guidance.

Tom
0 Kudos
KenBuja
MVP Esteemed Contributor
Have you seen this sample that puts the results of a GeoRSS feed on a graphics layer?
0 Kudos
TomRauch
Emerging Contributor
Ken, thanks, I have not seen that sample but it looks promising.  I will investigate further.  I am trying to create maps with location markers mostly through MXML and staying as light as I can on the AS3 coding.
0 Kudos