Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I'm adding an ArcGIS tile server to my openlayers tile server options via this javascript API. I have it displaying the map correctly, but it seems stretched out horizontally (I have a feeling the default projection may be causing this).

The URL I'm pointing it to is:

http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/export

And declaring the layer like so:

var layer = new OpenLayers.Layer.ArcGIS93Rest(null, 
        'http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map
         /MapServer/export',
        { layers:"0,1,2" } );

Does anyone know the projection I should be using? The API says I can specify a projection by adding an srs Projection ID property alongside my layers option, but I'm not sure even what the possible values are.

share|improve this question
    
try Spatial Reference: 102100 (3857) –  Brad Nesom Jun 6 '12 at 5:53
add comment

3 Answers

you dont need to define any srs to your ArcGIS93Rest layer if your map projection and service projection is identical.

    var options = {
        projection: new OpenLayers.Projection("EPSG:900913"),
        displayProjection: new OpenLayers.Projection("EPSG:4326"),
        units: "m",
    };

the below code working is working as it should work.

 arcRest= new OpenLayers.Layer.ArcGIS93Rest( "ArcGIS Server Layer",
                'http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map
                 /MapServer/export', 
                {layers: "show:0,2",
                 TRANSPARENT: true},
                {isBaseLayer: false,
                 extractAttributes: true});

i hope it helps you....

  map.addLayer(arcRest);
share|improve this answer
    
This helped me change the projection, but no matter what projection I use the map still appeared stretched. –  John Leehey Jun 6 '12 at 17:53
add comment

you can get to that information right on the rest endpoint.
http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer

enter image description here

share|improve this answer
    
This was very helpful, thank you. Manually setting the IMAGESR variable in the export URL to 3857 fixed the stretching for the tiles, but cause some very weird and incorrect tile image overlap. I suspect it is because I used a different BBOXSR value, but setting this to 3857 caused nothing but blank tiles to appear. –  John Leehey Jun 6 '12 at 18:02
add comment

So no matter what I tried and the different projections I used, the map would still appear stretched out.

I did, however, find a little hacky solution using the tile server at http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile. This works out very well. By translating the OSM url parameters, I leveraged the OSM layer API in OpenLayers to work for the ArcGIS server.

Here's the code:

var tileServiceURL = "http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer/tile/${z}/${y}/${x}";

layer = new OpenLayers.Layer.OSM(null, tileServiceURL, {
    transitionEffect: 'resize',
    wrapDateLine: false
});

If there are any issues that could arise from doing this, I'd be grateful to hear them, but for now this suits my needs perfectly.

share|improve this answer
    
if u tell, u want to use OSM we can say tile scheme have to change...This is still a good thing to have solved your problem by yourself.. –  Aragon Jun 7 '12 at 6:29
    
yeah, I had to change the tile scheme (the x and y parts of the tileServiceURL had to be swapped compared to the OSM tile URL scheme). Thanks! –  John Leehey Jun 7 '12 at 17:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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