0

I am new to openLayers. I am trying to display an in-house cached basemap from an ArcGIS REST service. I can see the basemap if I use "ol.source.TileArcGISRest" for the source property, but the performance is very slow and the map is rendered very blurry.

I am trying instead to use "ol.source.XYZ" for the source property of the layer (as recommended in OpenLayers docs), but I am now not seeing any map. The X and Y values I see in the Network tab of the developer tools are not in the range given in the REST endpoint for the tiled map. Our in-house maps all use NY State Plane (EPSG 2263).

FOr instance, at a zoom level of 0 (in the 'view' property' of the code), my sample attempts to get a tile with Z Y X parameters 9/192/150 and 9/192/151, but the start and end Z Y X values at zoom level 9 (as set in this tiled map REST service) are 9/646969/537582 and 9/657961/548957.

I am guessing this is a projection problem, but I thought I had set the default projection in my code. The full example is below:

Both the projection extent and extent in the layer properties are currently set from the extent given in the REST endpoint. I tried swapping out the projection extent with that given in the epsg URL, and tried commenting either of them out, to no effect.

<!DOCTYPE html>
<html>
   <head>
    <title>Tiled ArcGIS MapServer</title>
    <link rel="stylesheet" href="http://openlayers.org/en/v3.13.0/css/ol.css" type="text/css">
    <script src="http://openlayers.org/en/v3.13.0/build/ol.js"></script>
     script src="http://cdnjs.cloudflare.com/ajax/libs/proj4js/2.3.6/proj4.js" type="text/javascript"></script>
  <script src="http://epsg.io/2263-1188.js" type="text/javascript"></script>

  </head>
  <body>
   <div id="map" class="map"></div>
    <script>
      var url = 'http://inhouseserver/ArcGIS/rest/services/GAZETTEER/BASEMAP_2013_NuGreyII/MapServer/tile/{z}/{y}/{x}'
       //});

     var projection = ol.proj.get('EPSG:2263');
     projection.setExtent([901094.582736393, 137789.201259314, 1086146.66606973, 261157.256814869]);


     var layers = [
      new ol.layer.Tile({
       extent: [901094.582736393, 137789.201259314, 1086146.66606973, 261157.256814869],
       source: new ol.source.XYZ({
       url: url
       })
      })
      ];
    var map = new ol.Map({
      layers: layers,
      target: 'map',

    view: new ol.View({
       projection: projection,
       center: [ 982501, 199466],
        zoom: 0

     })
   });
  </script>
  </body>
 </html>
  • Can you try with: github.com/boundlessgeo/ole it will generate the config for you. Look at the layer-generator.html example. – bartvde Jan 22 '16 at 7:32
  • thanks--I got this error when i tried to build: npm ERR! ole@0.6.1 build: npm-run-all --parallel build:min build:debug npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the ole@0.6.1 build script 'npm-run-all --parallel build:min build:debug'. npm ERR! This is most likely a problem with the ole package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! npm-run-all --parallel build:min build:debug npm ERR! You can get their info via: npm ERR! npm owner ls ole npm ERR! There is likely additional logging output above. – JasonBK Jan 22 '16 at 15:55
  • @bartvde wondering if you had a chance to see the error log? I was not able to install ole using npm. – JasonBK Jan 24 '16 at 18:44
  • Can you paste the full log (npm-debug.log)? Also what platform are you on? Feel free to open up a github issue in ole for the further discussion. – bartvde Jan 25 '16 at 8:11
  • @bartvde thanks, I did open up an issue ticket on github github.com/boundlessgeo/ole/issues/15 .. I am on Windows 7 enterprise, 64 bit .. i posted the full error log on GitHub – JasonBK Jan 25 '16 at 13:50

Your Answer

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

Browse other questions tagged or ask your own question.