Invoke CalTopo URL via Javascript document submit request embedded in an HTML file

Lew Hitchner's Avatar

Lew Hitchner

01 Apr, 2017 07:10 PM

Has anyone tried this HTML code and gotten it or something similar to work?

    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <title>CalTopo Map Request Generator</title>
<body bgColor="#FFFFFF">

<h2 align="center" style="color:#FF0000;font-weight:bold">CalTopo Map Request Generator</h2>

<form name= "CalTopoMapRequest" action=",-111.61811&z=17&b=mbt" method="post">

<script type="text/javascript" language="JavaScript">

When I run this the result is
Sorry, something seems to have gone wrong!

This looks like an accidental form submission from map.html

You may be seeing this page because your session timed out. Try logging in again.

Return to the CalTopo Map Viewer.
If you think you've reached this page in error, email CalTopo support at [email blocked].

However, if I paste the URL,-111.61811&z=17&b=mbt directly into my browser's address block, it works. I have also tried encoding the '#' to "%23" within my HTML code, and I still get the same result.

I use identical code but with different URL strings for other map sites such as Acme Mapper, GPSVisualizer, and WikiMapia, and they all work fine.

I have tried this in Safari, Chrome, and Firefox. I am running an old OS X version (10.9, Mavericks) on an iMac 24" early 2009 with 3.06 GHz Intel Core 2 Duo.

  1. Support Staff 1 Posted by matt on 02 Apr, 2017 06:46 PM

    matt's Avatar

    The /map.html page only allows GET requests, not POST. If you skip the form and just set window.location to that URL, it should work fine. Changing the form action to GET would also likely work, but since the map page uses a URL hash rather than a query string, any form parameters would be ignored.

  2. 2 Posted by Lew Hitchner on 02 Apr, 2017 09:08 PM

    Lew Hitchner's Avatar

    Thanks, Matt. I switched my form method from POST to Get, and now my link to CalTopo works fine. I am not using any FORM parameters.

    Is there a way to pass a GET argument that will select a Map Overlay option such as "Fixed Slope Shading"? I thought I discovered somewhere (now I forget where) that "&a=fs" will select Fixed Shading. But, that doesn't work.

  3. Support Staff 3 Posted by matt on 02 Apr, 2017 10:35 PM

    matt's Avatar

    Go to, select the layers you want, and then pan the map. You can then figure it out from the URL hash. Fixed slope shading is sf, not fs.

  4. matt closed this discussion on 02 Apr, 2017 10:35 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac