Passing through url parameters a kml file path

stefano.grippa's Avatar

stefano.grippa

20 Dec, 2016 04:19 PM

I refer to closed thread:API for Caltopo for viewing kml file received from an application
you can add KML as one of the hash parameters, e.g. map.html#kml=urlencoded_url_to_your_kml_file

I don't remember off the top of my head if it will auto-center or if you also need to supply a center and zoom.

Please, how can I compose urlencoded_url_to_your_kml_file: can I use a relative path for my kml file or shall I use an absolute path?
Do you kindly have an example?

  1. Support Staff 1 Posted by matt on 20 Dec, 2016 05:58 PM

    matt's Avatar

    Take a URL, say http://example.com/file.kml. Then in javascript, call encodeURIComponent("http://example.com/file.kml"). Use that as the value for the kml property.

  2. matt closed this discussion on 20 Dec, 2016 05:58 PM.

  3. stefano.grippa re-opened this discussion on 20 Dec, 2016 06:42 PM

  4. 2 Posted by stefano.grippa on 20 Dec, 2016 06:42 PM

    stefano.grippa's Avatar

    Thank you.
    Can it be used also for files present only on my pc or must the file be present on a web server?
    That is can i use a path like c:/test or ./test as an url?
    Thanks

    Inviato dal mio dispositivo Huawei



    -------- Messaggio originale --------
    Oggetto: Re: Passing through url parameters a kml file path [Features and Suggestions #92]
    Da: matt
    A: [email blocked]
    CC:


    pre { width: 92%; margin: 10px 2%; padding: 5px 2%; background: #efefef; border: 1px solid #d6d6d6 } blockquote { margin-left: 0; padding-left: 1em; border-left: 5px solid #ccc; }

    // Please reply above this line
    ==================================================

    From: matt (Support staff)

    Take a URL, say http://example.com/file.kml. Then in javascript, call encodeURIComponent("http://example.com/file.kml"). Use that as the value for the kml property.

    On Tue, Dec 20 at 08:19 AM PST, stefano.grippa wrote:

    I refer to closed thread:API for Caltopo for viewing kml file received from an application
    you can add KML as one of the hash parameters, e.g. map.html#kml=urlencoded_url_to_your_kml_file

    I don't remember off the top of my head if it will auto-center or if you also need to supply a center and zoom.

    Please, how can I compose urlencoded_url_to_your_kml_file: can I use a relative path for my kml file or shall I use an absolute path?
    Do you kindly have an example?

    Having trouble reading this? View this discussion online: Passing through url parameters a kml file path.

    To unsubscribe and stop receiving emails from http://help.caltopo.com, visit this page

  5. Support Staff 3 Posted by matt on 20 Dec, 2016 07:22 PM

    matt's Avatar

    For security reasons, no browser will load a filesystem URL from an http page.

  6. matt closed this discussion on 20 Dec, 2016 07:22 PM.

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

Keyboard shortcuts

Generic

? 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