Select to view content in your preferred language

Change Point Symbol

1542
10
Jump to solution
02-20-2013 09:55 PM
YanuardiHerdiyono
Emerging Contributor
Hello All,

I have add georss layer (http://earthquake.usgs.gov/earthquakes/feed/atom/1.0/week) to my operational layer. How to change point symbol on georss layer type?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Yanuardi,
  
   Unfortunately yes it will require recompiling the viewer as the GeoRSSLayer currently is not configured to handle the renderer tag in the main config.xml like other layer types.

View solution in original post

0 Kudos
10 Replies
RobertScheitlin__GISP
MVP Emeritus
Yanuardi,

   GeoRSSLayers can be tricky as they can have multiple geometry types but here is a way based on the fact that the GeoRSS feed you are using is a point type geometry.

You need to specify the renderer in the Main config.xml:
            <layer label="Earthquakes GeoRSS" type="georss" visible="true" alpha="1"
                url="http://earthquake.usgs.gov/earthquakes/feed/atom/1.0/week">
                <simplerenderer>
                    <simplemarkersymbol style="diamond" size="12" color="0xff0000" alpha="1" />
                </simplerenderer>
            </layer>


And Unfortunately you will have to modify the viewers source code to use the renderer for the GeoRSSLayer. In the src\com\esri\viewer\managers\LayerCreator.as file:
    private static function createGeoRSSLayer(layerCreationProperties:LayerCreationProperties):GeoRSSLayer
    {
        var geoRSSLayer:GeoRSSLayer = new GeoRSSLayer(layerCreationProperties.url);

        geoRSSLayer.alpha = layerCreationProperties.alpha;
        geoRSSLayer.id = layerCreationProperties.label;
        geoRSSLayer.name = layerCreationProperties.label;
        geoRSSLayer.disableClientCaching = layerCreationProperties.disableClientCaching;
        if (layerCreationProperties.renderer)
        {
            geoRSSLayer.addEventListener(LayerEvent.LOAD,function loadSymbol(event:LayerEvent):void{
                FeatureLayer(geoRSSLayer.featureLayers[0]).renderer = layerCreationProperties.renderer;
            });
        }
        if (layerCreationProperties.serviceURL)
        {
            geoRSSLayer.serviceURL = layerCreationProperties.serviceURL;
        }
        if (!isNaN(layerCreationProperties.minScale))
        {
            geoRSSLayer.minScale = layerCreationProperties.minScale;
        }
        if (!isNaN(layerCreationProperties.maxScale))
        {
            geoRSSLayer.maxScale = layerCreationProperties.maxScale;
        }
        geoRSSLayer.visible = layerCreationProperties.visible;
        return geoRSSLayer;
    }



Don't forget to click the Mark as answer check on this post and to click the top arrow (promote).
Follow these steps as shown in the below graphic:

0 Kudos
YanuardiHerdiyono
Emerging Contributor
Thanks Robert for your answerd , it means I have to recompile source code using adobe builder?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Yanuardi,
  
   Unfortunately yes it will require recompiling the viewer as the GeoRSSLayer currently is not configured to handle the renderer tag in the main config.xml like other layer types.
0 Kudos
KennethLyons
Emerging Contributor
I'm attempting to do something similar to a GeoRSS feed that I'm working with.  The difference with mine is that I'm attempting to use the UniqueValueRenderer because there are a large number of values that can be used to identify symbols.  I've been successful using this function in the past on published services, however I'm not having any luck using it with a GeoRSS feed.  I believe that my issue is that I don't know the name of the field that the values would come from, but I am unsure.

Should the UniqueValueRenderer work correctly with a GeoRSS feed or am I wasting my time working on this solution.



Thanks
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Kenneth,

   To my knowledege a unique value rendereer on a GeoRSSLayer should work fine.
0 Kudos
KennethLyons
Emerging Contributor
R,

I'm working with Flex 3.4, will I need to make the changes to the LayerCreater.as you suggested in the previous posts in order for it to work correctly?

Thanks
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Kenneth,

   Nope it looks like it made it into 3.4.

Let me retract that...
Individual symbology made it into 3.2 of the viewer for GeoRSS

setting the renderer did not. So you you will have to add it
.
0 Kudos
KennethLyons
Emerging Contributor
I'm recieving errpr 1046: Type wasnot found or was not a compile-time constant: LayerEvent
Do I need to add a line to the "import" secton at the beginning of the .as?

Here is what I have I copied it straight from your previous post:

 private static function createGeoRSSLayer(layerCreationProperties:LayerCreationProperties):GeoRSSLayer
    {
        var geoRSSLayer:GeoRSSLayer = new GeoRSSLayer(layerCreationProperties.url);

        geoRSSLayer.alpha = layerCreationProperties.alpha;
        geoRSSLayer.id = layerCreationProperties.label;
        geoRSSLayer.name = layerCreationProperties.label;
        geoRSSLayer.disableClientCaching = layerCreationProperties.disableClientCaching;
        geoRSSLayer.showInLegend = layerCreationProperties.showInLegend;
        geoRSSLayer.visible = layerCreationProperties.visible;
  
  if (layerCreationProperties.renderer)
  {
   geoRSSLayer.addEventListener(LayerEvent.LOAD,function loadSymbol(event:LayerEvent):void{FeatureLayer(geoRSSLayer.featureLayers[0]).renderer = layerCreationProperties.renderer;});
  }

        if (layerCreationProperties.copyright != null)
        {
            geoRSSLayer.copyright = layerCreationProperties.copyright;
        }
        if (layerCreationProperties.serviceURL)
        {
            geoRSSLayer.serviceURL = layerCreationProperties.serviceURL;
        }
        if (!isNaN(layerCreationProperties.minScale))
        {
            geoRSSLayer.minScale = layerCreationProperties.minScale;
        }
        if (!isNaN(layerCreationProperties.maxScale))
        {
            geoRSSLayer.maxScale = layerCreationProperties.maxScale;
        }
        if (layerCreationProperties.markerSymbol)
        {
            geoRSSLayer.pointSymbol = layerCreationProperties.markerSymbol;
        }
        if (layerCreationProperties.lineSymbol)
        {
            geoRSSLayer.polylineSymbol = layerCreationProperties.lineSymbol;
        }
        if (layerCreationProperties.fillSymbol)
        {
            geoRSSLayer.polygonSymbol = layerCreationProperties.fillSymbol;
        }

        return geoRSSLayer;
    }


Thanks again
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Kenneth,

   Yes add
import com.esri.ags.events.LayerEvent;
0 Kudos