[OpenLayers-Users] Context Documents - WMC.html example

McGraw, Joanne mcgrawj at AGR.GC.CA
Tue Jul 29 15:54:57 EDT 2008


Well, I had noticed that the Map's units are identified as "degrees", but the Layer's units are correctly "meters" so assumed it was using this value out of the layer info somehow. There doesn't appear to be any way to set the units for the map within the context document. That is, I tried specifying the ol:units in the General Extension as I did in the Layer Extension but got the following error message: "TypeError: layerInfo.options has no properties", so assumed that wasn't an option. If there is some way to specify this, please let me know.

As for the scales/resolutions values, they are definitely wrong. All the scales are not a number ("NaN") and the resolutions default to what they are when the maxResolution is the whole world defined in lat/long. I realized that these values weren't being set properly, but can't figure out how to set them from within the context document. The easiest solution appears to be to set the maxResolution to "auto" and the map's units to "meters" somehow (as the map's extents are being set correctly already). Anyone know how to do that in a context document? I've tried the following in the general and the layer extensions with no impact: <ol:maxResolution xmlns:ol="http://openlayers.org/context">auto</ol:maxResolution>.

Still stuck,
jtm


Joanne T. McGraw
GIS Data Analyst / Analyste des données du SIG
National Land and Water Information Service/Service national sur les terres et les eaux
Agriculture and Agri-Food Canada / Agriculture et Agroalimentaire Canada
Telephone/Téléphone: 613 759-6103
Facsimile/Télécopieur: 613 715-5111
885 Meadowlands Drive - 3rd floor
Ottawa, Ontario
K1A 0C5
mcgrawj at agr.gc.ca
www.agr.gc.ca/nlwis-snite



-----Original Message-----
From: Bart van den Eijnden (OSGIS) [mailto:bartvde at osgis.nl] 
Sent: Tuesday, July 29, 2008 2:14 PM
To: McGraw, Joanne
Cc: users at openlayers.org
Subject: Re: [OpenLayers-Users] Context Documents - WMC.html example



Hi Joanne,

I use it with a different projection than EPSG:4326, but I have my map 
constructed beforehand and merge the context layers back into an 
existing map object. Also because it is hard for OL to guess what set of 
resolutions is a good match for your projection.

If I load the first document you sent, the units on the map (map.units) 
are still degrees, but I assume EPSG:42304 is meters or not?

Install Firebug, and see what WMS requests OL is sending, for instance 
now I am getting a BBOX which won't result in anything ofcourse.

&BBOX=339480,1962400,339840,1962760
or 339840,1962040,340200,1962400

My first guess would be the units. Otherwise check the set of 
resolutions/scales.

Best regards,
Bart

McGraw, Joanne wrote:
> Hello everyone,
>
> I have been trying to load a context document through the OpenLayers
> wmc.html example for a couple of days now to no avail. I am using
> OpenLayers 2.6 and MapServer 5.0.2.
>
> The context document I would like to display is included below (the
> first one); note the BoundingBox and Layer SRS and Extents, including
> the layer's ol:maxExtent and ol:units. That first context document does
> not display anything in the map in the wmc.html page but there is no
> suggestion that a problem occurred anywhere along the way. The browser
> "waits" for atlas.gc.ca and is eventually "Done", but no data displays.
>
> The second context document below does display the layer defined in the
> wmc.html map. The only things different between the two context
> documents are related to the SRS and extents. In the second context
> document, I use lat/long values and don't bother trying to set the
> ol:maxExtents and ol:units specifically. I just leave them at the
> defaults.
>
> When I look at the results of the GetCapabilities request to the
> atlaswms_en service, the definition for the "can_1m_bound" layer
> suggests I should be able to get the map using the EPSG:42304
> projection. For verification, the GetCapabilities xml can be obtained
> with:
> http://atlas.gc.ca/cgi-bin/atlaswms_en?service=WMS&version=1.1.1&request
> =getCapabilities 
>
> Are context documents using projections and extents that are not
> lat/long supported? I can't find any documentation suggesting that this
> is the case and that there is a problem with what I am trying to do.
> Assuming other SRS besides EPSG:4326 are supported, can anyone suggest
> where I am going wrong below?
>
> Cheers,
> jtm
>
> ------------------------------------------------------------------------
> --------
>
> <ViewContext xmlns="http://www.opengis.net/context" version="1.1.0"
> id="atlas_en" xsi:schemaLocation="http://www.opengis.net/context
> http://schemas.opengis.net/context/1.1.0/context.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <General>
>     <Window width="512" height="256"/>
>     <BoundingBox SRS="EPSG:42304" minx="-2700000" miny="-725000"
> maxx="3380000" maxy="4650000"/>
>     <Title>NLWIS Map</Title>
>         <Extension>
>             <ol:maxExtent xmlns:ol="http://openlayers.org/context"
> minx="-2750000" miny="-900000" maxx="3250000" maxy="3900000"/>
>         </Extension>
>   </General>
>   <LayerList>
>         <Layer queryable="1" hidden="0">
>             <Server service="OGC:WMS" version="1.1.1" title="National
> Atlas WMS">
>                 <OnlineResource xlink:type="simple"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://atlas.gc.ca/cgi-bin/atlaswms_en?"/>
>             </Server>
>             <Name>can_1m_bound</Name>
>             <Title>Boundaries (1:1 000 000)</Title>
>             <SRS>EPSG:42304</SRS>
>             <Extension>
>                 <ol:maxExtent xmlns:ol="http://openlayers.org/context"
> minx="-2700000" miny="-725000" maxx="3380000" maxy="4650000"/>
>                 <ol:units
> xmlns:ol="http://openlayers.org/context">meters</ol:units>
>             </Extension>
>         </Layer>
>   </LayerList>
> </ViewContext>
>
> ------------------------------------------------------------------------
> --------
>
> <ViewContext xmlns="http://www.opengis.net/context" version="1.1.0"
> id="atlas_en" xsi:schemaLocation="http://www.opengis.net/context
> http://schemas.opengis.net/context/1.1.0/context.xsd"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
> <General>
>     <Window width="512" height="256"/>
>     <BoundingBox SRS="EPSG:4326" minx="-142" miny="40.5" maxx="-51.5"
> maxy="84.5"/>
>     <Title>NLWIS Map</Title>
>         <Extension>
>             <ol:maxExtent xmlns:ol="http://openlayers.org/context"
> minx="-2750000" miny="-900000" maxx="3250000" maxy="3900000"/>
>         </Extension>
>   </General>
>   <LayerList>
>         <Layer queryable="1" hidden="0">
>             <Server service="OGC:WMS" version="1.1.1" title="National
> Atlas WMS">
>                 <OnlineResource xlink:type="simple"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xlink:href="http://atlas.gc.ca/cgi-bin/atlaswms_en?"/>
>             </Server>
>             <Name>can_1m_bound</Name>
>             <Title>Boundaries (1:1 000 000)</Title>
>             <SRS>EPSG:4326</SRS>
>             <Extension>
>                 <ol:maxExtent xmlns:ol="http://openlayers.org/context"
> minx="-142" miny="40.5" maxx="-51.5" maxy="84.5"/>
>             </Extension>
>         </Layer>
>   </LayerList>
> </ViewContext>
>
> ------------------------------------------------------------------------
> --------
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
>
>   


-- 
Bart van den Eijnden
OSGIS, Open Source GIS
bartvde at osgis.nl
http://www.osgis.nl




More information about the Users mailing list