GeoRSS projection

1513
6
08-04-2011 12:16 PM
CarlAlexander
New Contributor III
I am trying to use a GeoRSS feed that seems to be in geographic cooridantes so it will overlay in google maps.  When I try and use this feed in the Flex Viewer it shows the points all over the world.  Is there anything i can do to use this feed in the Flex Viewer?  Thanks.

http://ww2.tdot.state.tn.us/tsw/GeoRSS/TDOTConstructionGeorss.xml
Tags (2)
0 Kudos
6 Replies
ZahidChaudhry
Occasional Contributor III
I am trying to use a GeoRSS feed that seems to be in geographic cooridantes so it will overlay in google maps.  When I try and use this feed in the Flex Viewer it shows the points all over the world.  Is there anything i can do to use this feed in the Flex Viewer?  Thanks.

http://ww2.tdot.state.tn.us/tsw/GeoRSS/TDOTConstructionGeorss.xml


Simply make an HTTPservice request and then create graphics, reproject graphics to web mercator and display as graphics layer. This will give you more control, like mouse over and which information you want to display or filter. Also, you can try filtering data and custom symbols......
0 Kudos
CarlAlexander
New Contributor III
Thanks.  I will try this out.  Does ESRI have any documentation on how to do this?
0 Kudos
ZahidChaudhry
Occasional Contributor III
Thanks. I will try this out. Does ESRI have any documentation on how to do this?

I dont think so but you can check Adobe's website...they have very good tutorial, how to make an HTTP request...
you can do something like this...
<s:HTTPService id="srv" result="srv_resultHandler(event)" url="here your url"/>

and then in your result handler, you will get an xml back...

  • You can add all data to an arraycollection or use it as such

  • create a map point from lat/long

  • from map point create new graphic, add symbol, attributes

  • Add graphics to graphic layer

  • add graphics layer to the map..

here is a very good video from adobe, I am sure it will be very helpful.
http://www.adobe.com/devnet/flex/videotraining/_jcr_content/bodycontent1/modal_19.content.html' />
http://www.adobe.com/devnet/flex/videotraining/_jcr_content/bodycontent1/modal_19.content.html
0 Kudos
CarlAlexander
New Contributor III
Thanks.  I will look at videos.  I am not a programmer and was hoping there was a way to use the GeoRSS widget that is provided with the ArcGIS Viewer for Flex.  Thanks again.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Carl,

   If you have the ability to change code and recompile the viewer than there is a simple fix for this.

Replace the GeoRSSUtil.as code with this:

////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2010-2011 Esri
//
// All rights reserved under the copyright laws of the United States.
// You may freely redistribute and use this software, with or
// without modification, provided you include the original copyright
// and use restrictions.  See use restrictions in the file:
// <install location>/License.txt
//
////////////////////////////////////////////////////////////////////////////////
package com.esri.viewer.utils
{

    import com.esri.ags.geometry.Geometry;
    import com.esri.ags.geometry.MapPoint;
    import com.esri.ags.geometry.Polygon;
    import com.esri.ags.geometry.Polyline;
    
    import mx.utils.StringUtil;
    
    public class GeoRSSUtil
    {
        private static const GEORSS:Namespace = Namespaces.GEORSS_NS;
        private static const GEO:Namespace = Namespaces.GEO_NS;
        private static const GML:Namespace = Namespaces.GML_NS;
        private static const GEOLL:Namespace = Namespaces.GEO_LL;
    
        public function GeoRSSUtil(singletonEnforcer:SingletonEnforcer)
        {
        }
    
        public static function toGeometry(x:XML):Geometry
        {
            var georssPoint:String = String(x.GEORSS::point);
            if (georssPoint)
            {
                return parseGeoRSSPoint(georssPoint);
            }
            var georssLine:String = String(x.GEORSS::line);
            if (georssLine)
            {
                return parseGeoRSSLine(georssLine);
            }
            var georssPolygon:String = String(x.GEORSS::polygon);
            if (georssPolygon)
            {
                return parseGeoRSSPolygon(georssPolygon);
            }
            var pointList:XMLList = x.GEO::point;
            if (pointList && pointList.length() > 0)
            {
                var geoPoint:XML = pointList[0];
                var getLat:Number = Number(geoPoint.GEO::lat);
                var geoLon:Number = Number(geoPoint.GEO::long);
                return new MapPoint(geoLon, getLat);
            }
//My Add
            var markerPoint:String = String(x.marker);
            if (markerPoint)
            {
                return parseGeoRSSPoint(markerPoint);
            }
//End My Add
            var whereList:XMLList = x.GEORSS::where;
            if (whereList && whereList.length() > 0)
            {
                var pos:String = whereList[0].GML::Point[0].GML::pos[0];
                var arr:Array = pos.split(" ");
                var gmlLat:Number = Number(arr[0]);
                var gmlLon:Number = Number(arr[1]);
                return new MapPoint(gmlLon, gmlLat);
            }
            var georssLat:String = String(x.GEOLL::lat);
            var georssLong:Number = Number(x.GEOLL::long);
            if ((georssLong) && (georssLat))
            {
                return new MapPoint(Number(georssLong), Number(georssLat));
            }
            return null;
        }
    
        private static function parseGeoRSSWhere(x:XML):Geometry
        {
            return null;
        }
    
        private static function parseGeoRSSPoint(text:String):Geometry
        {
            var tokens:Array = StringUtil.trim(text).split(" ");
            var lat:Number = Number(tokens[0]);
            var lon:Number = Number(tokens[1]);
            return new MapPoint(lon, lat);
        }
    
        private static function parseGeoRSSLine(text:String):Geometry
        {
            var path:Array = [];
            var tokens:Array = StringUtil.trim(text).split(" ");
            if (tokens.length > 3)
            {
                for (var i:int = 0, j:int = 1; j < tokens.length; i += 2, j += 2)
                {
                    var lat:Number = Number(tokens);
                    var lon:Number = Number(tokens);
                    path.push(new MapPoint(lon, lat));
                }
            }
            return new Polyline([ path ]);
        }
    
        private static function parseGeoRSSPolygon(text:String):Geometry
        {
            var path:Array = [];
            var tokens:Array = StringUtil.trim(text).split(" ");
            for (var i:int = 0, j:int = 1; j < tokens.length; i += 2, j += 2)
            {
                var lat:Number = Number(tokens);
                var lon:Number = Number(tokens);
                path.push(new MapPoint(lon, lat));
            }
            return new Polygon([ path ]);
        }
    }
}

class SingletonEnforcer
{
}
0 Kudos
CarlAlexander
New Contributor III
Robert, this worked perferct.  Thanks.
0 Kudos