Comments (7)
You need to load it from a local http server. For that occasions I have a small script:
https://gist.github.com/TheMarex/b5a44fa78a036a42f1a2
That starts up a http server in the current directory which listens on https://127.0.0.1:8337
from osrm-frontend.
Thanks for sharing the script, that works great to get the frontend working locally. Do you know what part of the frontend requires a httpd? I am interested in using it for a mobile routing application using cordova, but loading a httpd on the phone probably isn't a good solution.
from osrm-frontend.
One of the primary issues is probably that the OSRM server is referred by a protocol relative URL (//router.project-osrm.org/viaroute
rather than for example http://router.project-osrm.org/viaroute
) which causes problem when the page is loaded from file://
. You can fix this by overriding the serviceUrl
option to the router instance (L.Routing.OSRM
).
However, there are other things that break when you use file://
, such as not being able to load things with XHR even locally without running into cross-site issues in normal browsers. I have no idea how Cordova deals with this, but I guess there must be a way to load local assets with XHR.
from osrm-frontend.
Thanks perliedman! Changing from a relative URL to a complete URL allows it to work properly without a httpd locally. Now I need to work on getting it working with Cordova.
from osrm-frontend.
@TheMarex Is this something we should fix, too?
from osrm-frontend.
@DennisOSRM nothing to fix on our side. Running from file:// is just a bad idea in general.
from osrm-frontend.
Alright, fair enough. We should add a section to the readme explaining how to run locally and what dependencies that carries.
from osrm-frontend.
Related Issues (20)
- Adding waypoints HOT 4
- Rework http://map.project-osrm.org/timestamps/ HOT 1
- Update image at hub.docker.com/r/osrm/osrm-frontend HOT 1
- Error on auto sending `hints=` from frontend to backend HOT 1
- Please update package-lock.json
- Where is the profile-selector control? HOT 2
- docker build local image can't be run HOT 3
- why leaflet? HOT 2
- undefined italian translation HOT 1
- osrm-backend-v5.26.0 and current osrm-frontend are not compatibl ?
- front end white screen HOT 6
- After bumping some dependency versions, every instruction step is "[object Object]"
- Japanese support not working
- Geolocation error: User denied geolocation prompt HOT 5
- Adjust start/end icons
- Coordinate difference between sliding the map right and left causing OSRM-backend InvalidValue response
- Feature suggestion: Add the OSRM backend tile service layer HOT 2
- Incompatibility with nominatim URLs
- Routing geocoders 'x' icons don't not handle clicks
- Errors when using the latest Dockerimage
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from osrm-frontend.