OSRM displays any route - javascript

API update yesterday OSRM and I'm having problems.
It calls previously used this way:
router.project-osrm.org/viaroute&loc=-0.88656,41.68043&output=json&compression=false
and it runs smoothly.
Now there is no way to make it work with the new version:
router.project-osrm.org/route/v1/driving/-0.88656,41.68043
This is the code for the old API, to see if anyone knows how to fix it.

Solved this call: https://router.project-osrm.org/nearest/v1/driving/41.680432,-0.88659841.68
Add https and nearest/v1/driving in URL.

Related

How to implement a redirect with HTMX?

HTMX is great and using AJAX for most of the stuff is awesome! But from time to time I just need a real "phyiscal" redirect to another page.
Any ideas how to achieve this without starting to write custom JS code?
Thx!
Luckily, after googleing for ages I found this post at Reddit: https://www.reddit.com/r/htmx/comments/ot6kai/comment/h6v5cn9/?utm_source=share&utm_medium=web2x&context=3
You can easily set the HX-Redirect header in your backend and on the return of the response, your browser will magically redirect.
The docs state this here but unfortunately don't explain it in more detail on other pages.
Supplemantal: I experienced an issue with JS errors occuring after the redirect - even though everything works fine.

How to Prevent Browser from Adding User Parameter in URL Of Apps Script Based Web App?

I have a web app functioning from the last two years but after updating some features and adding a new page I starting getting an error that Page not found.
When I looked further I got to know it is because of User Parameter in the URL which can be seen in screenshots '/u/1' is being added in my script URL Automatically as click on a link.
I tried removing it manually but it doesn't help, I have tried several modes of deployment.
And if I roll back to my older version it still works fine or if I log in only with a single account it works with the new version as well.
So I wanted some light is possible to overcome this issue?
I am just a part-time coder who can create something based on my needs so even after looking for the whole day I couldn't get it working so as of now I have rolled back to the old version.
Thanks in advance I am more than happy to share any more info required.
Screenshots attached with URL difference and error.
So I was able to find a workaround after roaming around in Google Forum as well they stated that it can not be solved since its intended behavior.
so what I did was done some modification in my function which was being used to get script URL and added some desired string to overcome user specific error when logged in with multiple users.
Here is the code
function getScriptUrl() {
var url = ScriptApp.getService().getUrl();
var stringToBeChanged = 'macros/s';
var newString = 'a/authentic.co.in/macros/s';
url = url.replace(stringToBeChanged,newString);
return url;
}
I hope this helps someone with a similar issue thank you for your support.

ExpiredKeyMapError - still error even if I generate a new API

I have a wordpress website made in 2016, and now the map doesn't work properly
anymore because of this console error (ExpiredKeyMapError).
I have created a new API but still doesn't work.
I have tried deleting the cache but still...
Maybe i need to wait some days for the new API starts to work properly? Or there is a way to make it work?
Anyone can help me?
Solved, because the template had a problem with API, i needed to contact the helpdesk.
Thank to all.

Geolocation not working on iOS with Meteor

It's been 5 hours i'm struggling with Meteor.
I want to get Geolocation.latLng(). It works perfectly on my browser, I coupled it with GoogleMaps to put a marker on a map. I'm following this example and didn't touch it much.
When I compile on iOS the Geolocation returns weird errors on my simulator (iPhone 6 / iOS 8.3) such as Geolocation failed : Position retrieval timed out, sometimes it's another one which's very similar (note : it asks me if i want to share my location when i launch the app, and i accept)
Sometimes it says it just compiled and I get an old version of my app too.
What's happening ? Is it me or it's really THAT buggy once you try to make a real world project ?
This to-do list tutorial looked very magic but once you understood how it works and you try something real, it's kind of disappointing ... Sounds very unstable and not ready.
Don't hesitate to tell me if i'm doing something wrong ;)
UPDATE : i've searched a lot more and i'm now trying to setup differently the timeout limit of the geolocation package to avoid this error.
Sadly, i realized timeout : Infinity is the default value of the source : sounds like an issue.
Nothing is working so far. If anyone has an idea, let me know on that too ...
I finally made it work. First I realized you have to setup the accessRule thank to Lucas's answer but it wasn't enough.
// In a mobile-config.js in the project
App.accessRule('*://maps.googleapis.com/*');
The iOS Simulator provided by Apple seems to have bugs : the position isn't retrieved correctly, or not at all. It's only working if i set the the Debug > Location to City Ride ; even Apple wasn't working properly on my hand.
If nothing works for you, just try all the possible Location, it might be the problem.
Have you define an accessRule in your mobile-config.js? If not, try this.
App.accessRule('*://maps.googleapis.com/*');
Here, clone this sample app I put together a while back:
https://github.com/ffxsam/whats-nearby
It works on desktop as well as mobile. All you have to do is add a settings.json and add your Google Places API key in there.
{
"apiKey": "...."
}

Google Analytics: _trackPageview without page refresh?

I'm reworking some site tracking for a site I'm working with. For the tracking we are currently using Google Analytics, which seems to be working fairly well. However, I'm having some troubles resembling the ones in this question, but it's old and no one answered, so I'm bumping a bit here. :)
Basically, I'm tracking two kinds of things. Raw pageviews (entering a page), and events on the page (lightbox opened, something important clicked, etc). I'm using _trackPageview for both kinds of events, because I need to be able to track some lightbox flows in GA's goal funnel tracking, and as I understand it _trackEvent calls can't be tracked in goal funnels.
The problem here is that it seems like the way GA works, it doesn't really post its data instantly (firebug doesn't show any requests happening, at least), but defers it to a page refresh or something like that. I'm not totally sure what happens, but basically I'm getting all events up to the first one leading to a page refresh all shuffled up in the funnel and looking like they all happened as an exit from the event causing the refresh. (Did that make sense? :) Is there any way of forcing GA to "flush" an event when it happens and not defer it? Or am I using things totally wrong?
EDIT: I was a bit blind reading the firebug logs... It does actually do the request to __utm.gif with the correct data. Makes the funnel being weird even more strange though, so the basic question is still valid.
Thanks
I made a function for this. We wanted to track how many people click on each on of a few links we have so we "track pageviews" for it.
function trackPV(trackerCode, url)
{
var tracker = _gat._getTracker(trackerCode);
if(url)
{
tracker._trackPageview(url);
}
else
{
tracker._trackPageview();
}
}
Basically, you pass in your tracker code (UA-XXXXX) and a url if you'd like to, such as "http://www.example.com/link1", by default it just tracks the page you are on.
Hope this helps.
I believe each call to _trackPageview will submit a unique request to Google Analytics (via parameters to the __utm.gif object). Google Analytics is pretty tough to debug since there is such a lag between the time your send your data, until it is actually visible online. Typically, you will have to wait 4+ hours before your data will show up - so maybe you just need to wait to confirm that your code is working.
Hmmm... I really only have experience with the old GA, but it seems to me that your best course of action is decoding the utm.gif request and seeing if it contains incorrect information. Here's a list of debugging tools that Google recommends.
use "event tracking" . At least check it out in google analytics help.

Categories