[mapserver-dev] Proposal to add built-in OpenLayers map viewer

Stephen Woodbridge woodbri at swoodbridge.com
Mon Sep 27 19:21:03 EDT 2010


Daniel,

One technical question I have is regarding versioning of OpenLayers. 
Since I assume you are just hitting the OpenLayers.org to pull in the JS 
do you need to be concerned about versions?

I think you would probably be safe within the OL 2.X versions but I'm 
not sure what OL 3.X will bring. Hopefully the trivial nature of this 
implementation will be able to side step any of those potential issues. 
You might want to talk to the OL dev team regarding future proofing such 
an implementation.

Obviously if it breaks down the line, we can do a dot release to fix it.

Anyway, something to think about.
I'm guessing this will not be a big issue.

-Steve W

On 9/27/2010 5:36 PM, Paul Spencer wrote:
> MapServer already supports something very much like this, you just
> need to put the path to the template (html file) in the WEB section
> of your map file.  I suspect you can override that with
> tempate=[something] as part of the CGI parameters, although there are
> some security settings that need to be respected.
>
> The advantage to Daniel's approach is that you don't need to have any
> external (local) dependencies, there are no templates to add to the
> various mapserver distributions and (presumably) no security
> constraints referencing external resources.
>
> I think a separate effort that would be useful would be to build
> templates for viewer X, figure out the correct magic for invoking
> them for a given mapserver distribution (i.e. ms4w, fgs, etc) and
> provide instructions on how to make it work.  Then ms4w users can
> develop a map file and know that they put TEMPLATE 'correct path'
> into their map files to have a quick preview using mode=browse
>
> Cheers
>
> Paul
>
> On 2010-09-27, at 4:17 PM, Dan Little wrote:
>
>> I sorta like the idea of "mode=browse" and then
>> "template=[template]"
>>
>> Then have a "$prefix/share" directory that contains the
>> "openlayers.html" template. So,
>> "mapserv?..stuff..&mode=browse&template=openlayers", would then
>> read form the share directory and regurgitate openlayers.html with
>> any parsing freebies we could pore into it.
>>
>>
>>
>> ----- Original Message ----
>>> From: "Lime, Steve D (DNR)"<Steve.Lime at state.mn.us> To: Daniel
>>> Morissette<dmorissette at mapgears.com>; MapServer Dev List
>>> <mapserver-dev at lists.osgeo.org> Sent: Mon, September 27, 2010
>>> 1:45:37 PM Subject: RE: [mapserver-dev] Proposal to add built-in
>>> OpenLayers map viewer
>>>
>>> Makes sense and would not prohibit other built in templates down
>>> the line.  So I'd be cool with mode=openlayers or even just
>>> mode=browse returning a  basic OL template if nothing else is
>>> defined.
>>>
>>> Steve
>>>
>>> -----Original Message----- From:
>>> mapserver-dev-bounces at lists.osgeo.org
>>> [mailto:mapserver-dev-bounces at lists.osgeo.org]  On Behalf Of
>>> Daniel Morissette Sent: Monday, September 27, 2010 1:11  PM To:
>>> MapServer Dev List Subject: Re: [mapserver-dev] Proposal to add
>>> built-in OpenLayers map viewer
>>>
>>> The need I'm trying to address is the  ability for mapfile
>>> developers to quickly test a mapfile just by typing a  simple URL
>>> in their web browser. While I can appreciate that admin tools and
>>> generic templates for all sorts of viewers and frameworks would
>>> be nice to  have, that is out of scope for what I am currently
>>> proposing.
>>>
>>> What I  propose is to add a simple function to mapserv.c (just a
>>> few lines, really)  that will spit out a few lines of
>>> HTML/JavaScript to instantiate a very  simple OpenLayers based
>>> viewer for a given mapfile in response to a mapserv  CGI request
>>> with mode=openlayers or a WMS GetMap request with
>>> format=application/openlayers. I do not envision the use of
>>> external or  configurable templates for this since that would
>>> imply dependencies on  external files an I would ideally like
>>> something really simple aimed at  mapfile developers that works
>>> out of the box with just the standalone mapserv  executable and a
>>> regular mapfile without any special  configuration.
>>>
>>> Does my explanation make sense? Is this not considered  useful
>>> enough by itself to justify adding to the mapserv CGI? If there
>>> are no  objections to this little addition then I will write a
>>> RFC for  it.
>>>
>>> Daniel
>>>
>>>
>>> Lime, Steve D (DNR) wrote:
>>>> So where are we  at? I do like the idea. The technical
>>>> solution, IMHO, will probably  point to how this might work
>>>> operationally. For example, if the plan  were to simply embed a
>>>> HTML/OL template in code then a mode=openlayers  would make
>>>> sense. However, if the template were stored externally and a
>>>> basic one shipped with MapServer then I'd opt for
>>>> mode=browse&template=openlayers. The advantage of the external
>>>> templates is extensibility and users could edit the one(s)
>>>> provided or  add their own. They could also disable the
>>>> functionality altogether by  removing all templates. The
>>>> downside is setting up access and then  security. If external
>>>> templates used the templating code and magic  strings that
>>>> would mitigate many issues...
>>>>
>>>>
>>>>
>>>> Steve
>>>>
>>>>
>>>>
>>>> *From:* mapserver-dev-bounces at lists.osgeo.org
>>>> [mailto:mapserver-dev-bounces at lists.osgeo.org]  *On Behalf Of
>>>> *Tamas
>>> Szekeres
>>>> *Sent:* Friday, September 24, 2010 4:46  PM *To:* Daniel
>>>> Morissette *Cc:* MapServer Dev List *Subject:* Re:
>>>> [mapserver-dev] Proposal to add built-in OpenLayers map viewer
>>>>
>>>>
>>>>
>>>> Daniel,
>>>>
>>>> Adding  a viewer with zoom and pan capabilities is a good idea
>>>> which is better  then having a single image in some cases. I
>>>> foresee a reasonable Web  administration interface to mapserver
>>>> could also be established by such  additions which would be a
>>>> requirement too. However embedding code from  a separate
>>>> project seems to be a hassle, though the technical solution
>>>> hasn't yet been mentioned in the ticket.
>>>>
>>>> I would be in favour  of doing either:
>>>>
>>>> 1. Create a simple  (mapserver specific)  .js to provide the
>>>> required functionality (which could be extended later  with
>>>> further options) 2. Provide a (pluggable) interface for use by
>>>> the  potential viewers in mapserver, and  create a separate
>>>> support  package for at least one (like openlayers for
>>>> instance) and include the  external code to this package.
>>>>
>>>>
>>>> (Just to put my 2 cents  in)
>>>>
>>>> Best regards,
>>>>
>>>> Tamas
>>>>
>>>>
>>>>
>>>>
>>>> 2010/9/24 Daniel Morissette<dmorissette at mapgears.com
>>>> <mailto:dmorissette at mapgears.com>>
>>>>
>>>> This was discussed at the code sprint in Barcelona, and I just
>>>> created  a ticket for it. We'd like to add this to 6.0... but I
>>>> am realizing  just now that maybe I should start with a RFC...
>>>>
>>>> Anyway, here is what I wrote in the ticket, please feel free to
>>>> comment, keeping in mind this has to remain __simple__:
>>>>
>>>> http://trac.osgeo.org/mapserver/ticket/3549
>>>>
>>>> Every once in a  while we get requests for a simple way to test
>>>> a mapfile. One way to  handle this could be to do as GeoServer
>>>> does and provide a built-in  OpenLayers based map viewer. In
>>>> the GeoServer case, this viewer is  returned when one issues a
>>>> WMS GetMap request with format=application/openlayers in it.
>>>>
>>>> I propose that we provide  a similar functionality in
>>>> MapServer, which would be triggered in one of  two ways:
>>>>
>>>> 1- Using  mapserv?map=/path/to/my.map&'''mode=openlayers''' ...
>>>> in this case  the viewer would be initialized based on the
>>>> mapfile defaults, and some  of the traditional mapserv CGI
>>>> params may also work (such as map size,  layer selection,
>>>> etc.)
>>>>
>>>> 2- Using  '''format=application/openlayers''' in a WMS GetMap
>>>> request as GeoServer  does. Note that in this case the rest of
>>>> the GetMap parameters would be  used to configure the map to
>>>> view (BBOX, WIDTH, HEIGHT, LAYERS, etc.)
>>>>
>>>> Both cases would call the same function internally to  produce
>>>> a simple OpenLayeres viewer with one singletile layer for the
>>>> whole map with the selected layers.
>>>>
>>>>
>>>> -- Daniel Morissette http://www.mapgears.com/
>>>> _______________________________________________ mapserver-dev
>>>> mailing  list
>>>> mapserver-dev at lists.osgeo.org<mailto:mapserver-dev at lists.osgeo.org>
>>>>
>>>>
http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>>>>
>>>>
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>>
>>>>
_______________________________________________
>>>> mapserver-dev  mailing list mapserver-dev at lists.osgeo.org
>>>> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>>>
>>>
>>> -- Daniel Morissette http://www.mapgears.com/
>>> _______________________________________________ mapserver-dev
>>> mailing list mapserver-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>>>
>>>
>>> _______________________________________________ mapserver-dev
>>> mailing list mapserver-dev at lists.osgeo.org
>>> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>>>
>>
>>
>>
>> _______________________________________________ mapserver-dev
>> mailing list mapserver-dev at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapserver-dev
>
>
> __________________________________________
>
> Paul Spencer Chief Technology Officer DM Solutions Group Inc
> http://research.dmsolutions.ca/
>
> _______________________________________________ mapserver-dev mailing
> list mapserver-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-dev



More information about the mapserver-dev mailing list