[mapserver-users] ASP as template file

Brent Fraser bfraser at geoanalytic.com
Wed Jun 5 16:37:34 EDT 2002


Ed,

  Good point.  I would highly recommend the simplicity of using only
templates if possible.

    In my case the reason I resorted to ASP because I wanted to display
thumbnails of images that are in a directory structrure based on parts of
the ID of the particular image.  I didn't want to change the structure and I
didn't want to put the path as an attribute in my shapefile (although in
hindsight I think that might be a less convoluted/better solution) which
would have allowed me to use only the stock template mechanism.  So I used
ASP to decode the ID and build the path on the fly.

    As a result I've got a mapping site that uses HTML, Java, JavaScript,
AND VBScript.  Not to mention of course it is now dependant on Microsoft's
IIS... Bummer.

   Now if  I could only find a reason to add some Perl, PHP, Python, C#,
Pascal, Fortran, COBOL... ;)

Brent

----- Original Message -----
From: "Ed McNierney" <ed at topozone.com>
To: "Brent Fraser" <bfraser at geoanalytic.com>; "Christian Runge"
<crg at carlbro.dk>; <mapserver-users at lists.gis.umn.edu>
Sent: Wednesday, June 05, 2002 2:01 PM
Subject: RE: [mapserver-users] ASP as template file


> Brent -
>
> Yes, that's a good way to address the issue.  But you've still got two
separate URLs (HTTP requests) involved - one to the MapServer CGI, and
another to an ASP page.  The MapServer CGI doesn't return ASP code, of
course - it programmatically generates the parameters to an ASP page.  The
"redirection" is indeed necessary - you need to send two distinct HTTP
requests.  One goes to the MapServer CGI, and one goes to the ASP processor.
>
> I find that some of the difficulty users find in mixing/matching MapServer
and ASP is that MapServer's template mechanism provides a different way of
doing many things one can do in ASP (or in other front-end scripting
environments; there's nothing special about ASP).  That's great because you
don't NEED a scripting environment to do a lot of cool things with
MapServer, but it seems to confuse people who get started with MapServer
templates and then try to figure out how to "add ASP".
>
> - Ed
>
> -----Original Message-----
> From: Brent Fraser [mailto:bfraser at geoanalytic.com]
> Sent: Wednesday, June 05, 2002 3:19 PM
> To: Christian Runge; mapserver-users at lists.gis.umn.edu
> Subject: Re: [mapserver-users] ASP as template file
>
>
> Chris, Ed, and others...
>
>   We did a little project with standard CGI (no ASP front-end) MapServer
3.5
> using ASP (under IIS 4)to return query results.  Our query template looked
> like:
>
> IMapPro.html:
> ===============================================
> <HTML>
> <HEAD>
> </head>
> <BODY><CENTER>
> <script language="javascript">
>
(window.location="/test/imappro1.asp?strtile=[TILEID]&intutm=[UTMZONE]&strim
> gdate=[IMAGEDATES]")
> </script>
> </HTML>
> ===============================================
> (Note that the JavaScript causes the results to be displayed in a
> new/separate window than the one the map interface is in.)
>
>   The ASP code (VBScript in our case) gets the values of the variables
that
> were substituted as part of Mapserver processing the template:
>
> imappro1.asp:
> ===============================================
> <HTML>
> <HEAD>
> </head>
> <BODY>
> <%
> strtile = request.QueryString ("strtile")
> strimgdate=request.QueryString ("strimgdate")
> intutm=request.QueryString ("intutm")
>
> strlevel1=mid(strtile,1,5)
> strlevel2=mid(strtile,1, 6)
> strlevel3=mid(strtile,3, 6)
> %>
>
> <H1><b>Image Maps PRO</b></H1>
>
> <table cellpadding=5 cellspacing=2 border=1>
> <tr><th> Product Status </th><th> Tile ID </th><th> Image Dates </th></tr>
> <tr><td> AVAILABLE </td><td> <%=strtile%> </td><td> <%=strimgdate%>
> </td></tr>
> </TABLE>
> </HTML>
> ===============================================
>
> I'm not sure the re-direction is strictly necessary.  I seem to recall
> MapServer having a problem with templates having an extension of ASP (and
> indicating to IIS to treat it as ASP), and IIS having a problem with ASP
> files with an extension of HTML.
>
> Nothing like a little re-direction to solve a web problem....
>
> Brent Fraser
> GeoAnalytic Inc.
> bfraser at geoanalytic.com
>
> ----- Original Message -----
> From: "Ed McNierney" <ed at topozone.com>
> To: "Christian Runge" <crg at carlbro.dk>;
<mapserver-users at lists.gis.umn.edu>
> Sent: Wednesday, June 05, 2002 8:51 AM
> Subject: RE: [mapserver-users] ASP as template file
>
>
> > Christian -
> >
> > What you're doing wrong is trying to use ASP like this - it simply won't
> work.  Your client browser makes an HTTP request to the MapServer CGI
> program, which processes the MAP file, the TEMPLATE file, and the CGI
> parameters to generate an output stream that's sent to the client in
> response to that HTTP request.  Alternatively, your client browser could
> make an HTTP request to the ASP parser program, which processes an ASP
file
> and generates an output stream that's sent to the client in response to
that
> HTTP request.  But a given HTTP request can't do both.
> >
> > Depending on your circumstances, you might be better off using fewer of
> the MapServer template features and replacing them with ASP functionality
> instead.  I wrote a wordy note to the list a little while ago about using
> ASP with MapServer - you can find it in the archives at:
> >
> > http://mapserver.gis.umn.edu/wilma/mapserver-users/0110/msg00296.html
> >
> > - Ed
> >
> > Ed McNierney
> > Chief Mapmaker
> > TopoZone.com
> > ed at topozone.com
> > (978) 251-4242
> >
> >
> > -----Original Message-----
> > From: Christian Runge [mailto:crg at carlbro.dk]
> > Sent: Wednesday, June 05, 2002 9:26 AM
> > To: 'mapserver-users at lists.gis.umn.edu'
> > Subject: [mapserver-users] ASP as template file
> >
> >
> > Hello everyone.
> >
> > I'm working with a map where I need to do some queries. I would like the
> > result of those queries to be handles by an active server page insted of
a
> > simple html file. The following worked fine in version 3.4:
> >
> > QUERY
> > TEMPLATE 'processquery.asp'
> > END
> >
> > Now I'm trying to do the same in version 3.5 and I believe this should
be
> > correct syntax:
> >
> > LAYER
> > ....(omitted)...
> > CLASS
> >     SIZE 1
> >     TEMPLATE 'processquery.asp'
> > END #Class
> > END #Layer
> >
> > For some reason the asp is not parsed by the asp parser and the entire
> > content is sent to the client browser (which ignores it of course). What
> do
> > I do wrong?
> >
> > Thanks in advance
> > Christian Runge
> >
> > P.S. I use the following system when running it:
> > Windows 2000 server
> > Internet Information Server
> > Mapserver 3.5
> > Internet Explorer 5.5 as test client
>




More information about the mapserver-users mailing list