Wednesday, 16 March 2016

openlayers 2 - How can i use ArcGIS server 10 mapservices in OpenLayers2?



I'm new in OpenLayers. I'd like to use mapservice of ArcGIS server 10 in open layers.I search and found examples of using an ArcGIS Server 9.3 Rest API layer for OpenLayers. I found OpenLayers.Layer.ArcGIS93Rest instance but not ArcGIS 10 . How can I use ArcGIS server 10 services in Openlayers? I wrote the below code . I use ArcGIS server 10 and The REST is working right .







My OpenLayers Map











Answer



Without Looking at your code, I can't say why you can't access your ArcGIS Server 10 layer. But I can access ArcGIS map service layers in my OpenLayers App in the following ways:



  • When the map service is a tiled Mapservice in WebMercator, I can use the following code:


layer = new OpenLayers.Layer.XYZ( "ESRI", "http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer/tile/${z}/${y}/${x}", {sphericalMercator: true} );



  • When I have a dynamic mapservice, I can use the following code:



layer = new OpenLayers.Layer.ArcGIS93Rest( "ArcGIS Server Layer", "http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StateCityHighway_USA/MapServer/export", {layers: "show:0,2"});


There are two working examples on the OpenLayers website:



  1. Basic ESRI Map Cache Example

  2. ArcGIS Server 9.3 Rest API Example


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...