3

Sorry I'm newbie in ESRI API javascript, I'm trying to to change the GeoRSS projection from from 102100 to 54030. could anyone give me a hand?! please! my project script is:

var map;
require([
"esri/map", "esri/SpatialReference", "esri/layers/ArcGISTiledMapServiceLayer",   "esri/layers/GeoRSSLayer", "esri/InfoTemplate",
"dojo/parser", "dojo/_base/array", "dojo/dom-style", 
"dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!"
], 
function(
Map, Tiled, GeoRSSLayer, InfoTemplate,
parser, arrayUtils, domStyle
) {
map = new Map ("map");
var tiled = new Tiled ("//.../arcgis/rest/services/.../MapServer");
//==> ROBINSON
map.addLayer (tiled);


// create layout dijits

parser.parse();

var georssUrl = "...gml"; 
//==> MERCATOR 
var georss = new GeoRSSLayer(georssUrl, SpatialReference); 
georss.on("load", function() {
  domStyle.set("loading", "display", "none");
  // create an info template
  var template = new InfoTemplate("${name}", "${description}");
  // set the info template for the feature layers that make up the GeoRSS layer
  // the GeoRSS layer contains one feature layer for each geometry type
  var SpatialReference=new SpatialReference (54030);
  var layers = georss.getFeatureLayers();
  arrayUtils.forEach(layers, function(l) {
    l.setInfoTemplate(template);    

 });
});
 map.addLayer(georss);
});
  • Thanks for you answer, it was very useful. I already changed the script and my debugger does not find errors, but no object is displayed. certainly the error is very stupid but I can not find it. var map; require([ "esri/map", "esri/layers/ArcGISTiledMapServiceLayer", "esri/layers/GeoRSSLayer", "esri/InfoTemplate", "dojo/parser", "dojo/_base/array", "dojo/dom-style", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!" ], function( Map, Tiled, GeoRSSLayer, InfoTemplate, parser, arrayUtils, domStyle ) { map = new Map ("map"); var tiled = new Tiled ("..."); map.addLayer ( – user22680 Oct 7 '13 at 10:05
  • At this point, you must provide all of the code in order for me to help you. – CLJ Oct 7 '13 at 13:01
  • Sorry, and thank you again for the help.. <!doctype html> <html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10"> <meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"> <title>GEORSS</title> <link rel="stylesheet" href="js.arcgis.com/3.7/js/dojo/dijit/themes/soria /soria.css"> <link rel="stylesheet" href="js.arcgis.com/3.7/js/esri/css/esri.css"> <style> html, body, #mapDiv { height: 100%; width: 100%; margin: 0; padding: 0; } </style> <script src="js.arcgis.com/3. – user22691 Oct 7 '13 at 14:39
  • no, this is the whole script. I can not find the error, some ideas? – user22691 Oct 7 '13 at 15:21
3

The GeoRSSLayer's options parameter has an outSpatialReference property. Use this to specify the SR you want, in this case, 54030.

On the backend, a service is used to convert the contents of your GeoRSS file to the desired SR.

Here's an example of adding your GeoRSS file to an Albers (SR wkid is 102003) map:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=7, IE=9, IE=10">
    <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
    <title></title>
    <link rel="stylesheet" href="//js.arcgis.com/3.7/js/esri/css/esri.css">
    <style>
      html, body, #map {
        height: 100%; width: 100%; margin: 0; padding: 0; 
      }
    </style>

    <script src="//js.arcgis.com/3.7/"></script>
    <script>
      var map;

      require([
        "esri/map", "esri/SpatialReference", "esri/geometry/Extent", 
        "esri/layers/GeoRSSLayer", "esri/layers/ArcGISTiledMapServiceLayer",
        "esri/symbols/SimpleFillSymbol", "dojo/domReady!"
      ], function(
        Map, SpatialReference, Extent,
        GeoRSSLayer, ArcGISTiledMapServiceLayer,
        SimpleFillSymbol
      ) {
        var bbox = new Extent({"xmin":-1269513,"ymin":-4841971,"xmax":6946918,"ymax":6170351,"spatialReference":{"wkid":102003}});
        map = new Map("map", { extent: bbox });
        var dark = new ArcGISTiledMapServiceLayer("http://tiles.arcgis.com/tiles/nGt4QxSblgDfeJn9/arcgis/rest/services/Dark_Gray_Albers_North_America_Base/MapServer");
        map.addLayer(dark);
        var georss = new GeoRSSLayer("http://db.tt/z7nry2O3", {
          outSpatialReference: new SpatialReference(102003)
        });
        map.addLayer(georss);
      });
    </script>
  </head>
  <body>
    <div id="map"></div>
  </body>
</html>

No need to use a geometry service.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.