Displaying WMS layer from ArcGIS 10

classic Classic list List threaded Threaded
2 messages Options
crb
Reply | Threaded
Open this post in threaded view
|

Displaying WMS layer from ArcGIS 10

crb
Apologies if this is a dup from an earlier response to this thread, but that thread said 'This post has NOT been accepted by the mailing list yet.' so not sure it's visible to others...

I'm trying to add an AGS v10 layer to an OL map but it only seems to work if:
- map.projection = WGS84
- map.displayProjection = WGS84
- isBaseLayer = true

My end goal is to use Bing base maps in EPSG:900913, so my map.projection will be EPSG:900913 and my map.displayProjection will be EPSG:4326.  But the only way I can get AGS v10 REST and WMS services to display in an OL map is to set the map.projection, map.displayProjection and layer.projection to EPSG:4326. I'm using OL v2.11, am hoping that supports WMS 1.3?

I have AGS v10 services published as both REST and WMS.  The CRS of the REST service is '102100 (3857)'. EPSG doesn't recognize 102100 which I believe is ESRI's own designation, so I experimented using 3857. If I view the service in an ESRI client (ArcMap, ArcCatalog) then it displays with the correct projection.  But the only way I can display the layer at all in an OL map, whether using a OpenLayers.Layer.ArcGIS93Rest or a OpenLayers.Layer.WMS layer, is to use 4326 for both map.projection and map.displayProjection, which of course will not overlay on top of the Bing base layers.

While I'd prefer to be able to use WMS, any workaround would be acceptable.  I wasn't able to get WFS to display at all, but that may be because I don't have all the OL layer params that are required.  I tried:

var layer = new OpenLayers.Layer.WFS(
            "Counties",
            "http://myserver/arcgis/services/county_wm/MapServer/WFSServer?",
                        { layers: "0" }
);

I found this information as well and tried that solution using a map.projection of 3857 for map.projection, map.displayProjection and layer.projection, e.g.:

var options =
{
    'units': 'm'
};

var map = new OpenLayers.Map('gxmap', options);

mapprj = new OpenLayers.Projection("EPSG:3857");
dspprj = new OpenLayers.Projection("EPSG:3857");

map.projection = mapprj;
map.displayProjection = dspprj;

var layer = new OpenLayers.Layer.WMS(
    "Counties",
    "http://myserver/arcgis/services/county_wm/MapServer/WMSServer?",
    {
        layers: "0",
        format: 'image/png',
        srs: 'EPSG:3857'
    },
    {
        opacity: 0.5,
        singleTile: false,
        projection: 'EPSG:3857'
    } 
);

but still no go.  My WMS capabilities file for this layer looks thus:

<Layer queryable="1">
    <Name>0</Name>
    <Title>
        <![CDATA[ county_webmerc ]]>
    </Title>
    <Abstract>
        <![CDATA[ county_webmerc ]]>
    </Abstract>
    <CRS>CRS:84</CRS>
    <CRS>EPSG:4326</CRS>
    <CRS>EPSG:3857</CRS>
    <EX_GeographicBoundingBox>
        <westBoundLongitude>-90.4182892958519</westBoundLongitude>
        <eastBoundLongitude>-82.4134778047652</eastBoundLongitude>
        <southBoundLatitude>41.6961255799368</southBoundLatitude>
        <northBoundLatitude>48.262692384982</northBoundLatitude>
    </EX_GeographicBoundingBox>
    <BoundingBox CRS="CRS:84" minx="-90.4182892958519" miny="41.6961255799368" maxx="-82.4134778047652" maxy="48.262692384982"/>
    <BoundingBox CRS="EPSG:4326" minx="-90.4182892958519" miny="41.6961255799368" maxx="-82.4134778047652" maxy="48.262692384982"/>
    <BoundingBox CRS="EPSG:3857" minx="-10065317.9228131" miny="5115568.65804322" maxx="-9174226.38372922" maxy="6150669.28758651"/>
    <Style>
        <Name>default</Name>
        <Title>0</Title>
        <LegendURL width="32" height="16">
            <Format>image/png</Format>
        <OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="http://gis4/arcgis/services/MI/county_wm/MapServer/WMSServer?request=GetLegendGraphic%26version=1.3.0%26format=image/png%26layer=0" xlink:type="simple"/>
        </LegendURL>
    </Style>
</Layer>

Have also tried using 'crs' for layer instead of 'srs' per this thread, but still no go.

Also worried that the 'isBaseLayer=true' will be required even if I do figure out the projection issue, since I need to display these as overlays.

Has anyone been able to get a non-WGS84 ArcGIS v10 layer -- either REST or WMS -- to display in an OL map?
crb
Reply | Threaded
Open this post in threaded view
|

Re: Displaying WMS layer from ArcGIS 10

crb
O.K.  Figured this out, thanks to James Fee, his 2009 Dev Summit presentation, and the spherical mercator example at mkgeomatics. Basically just had to publish an AGS service in WGS84 and in OL use a map.projection of EPSG:102113.

Also found some cool stuff for using AGS json in OL (and important potato cooking safety tips) at mapbutcher in the process...