[mapserver-users] URL encoding with mapserver 3.5

Brian Fischer bfischer at mpls.houstoneng.com
Fri Nov 2 14:46:54 EST 2001


Brent,

Check out my posting from a few months ago.  It should answer your
question.

Brian Fischer
Houston Engineering, Inc. 
Maple Grove, MN 55369

POSTING:
Or use the [getlayers] string. It gives you a properly escaped list of
layers starting with '&layer=name1&layer="... Because of that format it
should just be appended to the end of the URL. Note in 3.5 most
substitutions can be requested in escaped or non-escaped forms so you'd
use [layers_esc] or [layers].

Steve

Stephen Lime
Internet Applications Analyst

Minnesota DNR
500 Lafayette Road
St. Paul, MN 55155
651-297-2937

>>> "Brian Fischer" <bfischer at mpls.houstoneng.com> 09/13/01 08:44AM >>>
Thanks Regina.  Your suggestion worked great.  It now works in both
Explorer and Netscape.  I already had the URL in a JavaScript function,
so all I had to do is add the escape function.  

function printmap() {
 OpenPrintWin =
this.open("http://www.houstoneng.com/mapserv/cgi-bin/mapserv.exe?&map=[m

ap]&template=printmap.html&layers=" + escape('[layers]') +
"&mapext=[minx]+[miny]+[maxx]+[maxy]", "PrintWindow",
"toolbar=yes,menubar=yes,location=yes,scrollbars=yes,resizable=yes");
}

Tom, I did not try your suggestion but I'm sure it would of worked also.
It was the same concept as Regina's suggestion.

Thanks again to everyone,
Brian

-----Original Message-----
From: Obe, Regina DND\MIS [mailto:Regina.Obe.PFD at ci.boston.ma.us] 
Sent: Thursday, September 13, 2001 7:41 AM
To: Brian Fischer; 'mapserver-users at lists.gis.umn.edu' 
Subject: RE: [mapserver-users] Problem with Netscape treating a space
different than Internet Explorer 

You have to URL Encode the layers section.  IE does an implicit URL
Encode when it sees spaces in a URL tag whereas Netscape doesn't.

Try this line in place of your URL

<SCRIPT language=javascript>document.writeln("<A
HREF=\"http://www.houstoneng.com/mapserv/cgi-bin/mapserv.exe?&map=[map]&

temp
late=printmap.html&layers=" + escape('[layers]') +
"&mapext=[minx]+[miny]+[maxx]+[maxy]\">The Hyperlink label goes
here</A>")</SCRIPT>

I don't have a netscape browser handy at the moment so couldn't test it.




-----Original Message-----
From: Brian Fischer [mailto:bfischer at mpls.houstoneng.com] 
Sent: Wednesday, September 12, 2001 5:44 PM
To: mapserver-users at lists.gis.umn.edu 
Subject: [mapserver-users] Problem with Netscape treating a space
different than Internet Explorer 


Mapserver community,
 
I was wondering if anyone else has had this problem.  I assume there
must be a way around it, but can't find a solution.
 
Here is the problem: I am using the [layers] cgi variable in a hyperlink
like shown below.
 
http://www.houstoneng.com/mapserv/cgi-bin/mapserv.exe?&map=[map]&templat

e=pr intmap.html&layers=[layers]&mapext=[minx]+[miny]+[maxx]+[maxy]
 
The problem is Netscape does not replace the space with a %20, but
Internet Explorer does.
 
Internet Explorer 5.5 URL:
http://www.houstoneng.com/mapserv/cgi-bin/mapserv.exe?&map=projects/fgdc

/map
viewer/mapviewer.map&template=printmap.html&layers=lakes%20Rivers%20Road
s&ma
pext=-100.092035+47.222059+-94.531453+51.668504
 
Netscape 4.7 URL:
http://www.houstoneng.com/mapserv/cgi-bin/mapserv.exe?&map=projects/fgdc

/map
viewer/mapviewer.map&template=printmap.html&layers=lakes Rivers
Roads&mapext=-96.766990+48.008085+-95.278996+49.197928
 
Any suggestions would be greatly appreciated.
 
Thanks,
Brian

-----Original Message-----
From: Brent Lund [mailto:brent.lund at mnplan.state.mn.us] 
Sent: Friday, November 02, 2001 11:32 AM
To: <
Subject: [mapserver-users] URL encoding with mapserver 3.5


The following problem occurs with netscape 4.7.    Netscape 6 and IE fix
the url on the fly.

I am attempting to generate a query using the shape extent.  I have done
this with previous revs of Mapserver no problem, but 3.5 appears to be
failing in the url encoding of the shape extent.

For example, within the template line I've assigned the new mapext as
follows.
mapext=[shpext]
When using netscape 4.7, this generates  mapext=437235.843750
5045171.000000 466844.718750 5121648.000000.   Mapserver 3.5 then
complains
"loadForm(): Web application error. Not enough arguments for mapext."

previous versions would have replaced the spaces with a "+",   I believe
the correct url encode would be "%20" in place of the spaces(both
netscape 6 and ie do this automatically).

Am I missing a setting or is this a bug?


Brent






Brent Lund
Programmer Analyst
658 Cedar Street
St. Paul MN 55155

(651) 297-2487
brent.lund at mnplan.state.mn.us




More information about the mapserver-users mailing list