NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum

If I implement a gpx track from a file of my harddisk to an OpenLayer it works great as long as the gpx file is in the same directory or in a directory down. I receive the map from the internet and the track from the harddisk can be seen.

var GPXVariable_1 = new OpenLayers.Layer.Vector("Alpspitze", {

strategies: [new OpenLayers.Strategy.Fixed()], protocol: new OpenLayers.Protocol.HTTP({
url:"Alpspitze.gpx", format: new OpenLayers.Format.GPX()
        }),  // works

... url:"directory_x/Alpspitze.gpx" // works

If I try to implement a gpx file that is in a different directory structure, it doesn't work.

... url:"../../directory_y/directory_z/Alpspitze.gpx" // doesn't work

What am I doing wrong? What is the correct syntax for the address?

This question is marked "community wiki".

asked 07 Aug '14, 17:56

flegar's gravatar image

flegar
26112
accept rate: 0%


Maybe it is a security mechanism of the browser to prevent JavaScript code to read your whole file system and independent on OpenLayers.

permanent link

answered 08 Aug '14, 12:29

MarkusHD's gravatar image

MarkusHD
375410
accept rate: 12%

In the meantime, I've got an answer from a different forum.

Unfortunatelly there ist a restriction that allows local documents having access to other local documents in the same directory and in subdirectories, but not directory listings.

When I change the config:about (Firefox) security.fileuri.origin_policy to false, the track gets visible although it is implemented from a different file tree.

Conclusion: Due to the security police of browsers I have to rearrange my directory.

permanent link

answered 08 Aug '14, 12:46

flegar's gravatar image

flegar
26112
accept rate: 0%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×255
×122
×112
×39

question asked: 07 Aug '14, 17:56

question was seen: 3,673 times

last updated: 08 Aug '14, 12:46

NOTICE: help.openstreetmap.org is no longer in use from 1st March 2024. Please use the OpenStreetMap Community Forum