-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
plugin fails to transform clicked coordinates #2
Comments
It’s not the token. You have some weird coordinate system.. Is it defined in qgis? The built in map tool should transform that to wgs84 when you click in the canvas, which only works if the CRS is known to qgis. |
It did happen to me too before (the plugin not transforming my coords when I click) and I'm not sure why that happens and don't have the time right now to look into it, but will fairly soon.. For me it's solved when I reload QGIS. |
these are lest97 (3301) coordinates. I didn't realise it was converting until now :). # Define the request
params = {'access_token': self.key}
authed_url = self._generate_auth_url(url,
params,
)
url_object = QUrl(self.base_url + authed_url)
self.url = url_object.url()
body = QJsonDocument.fromJson(json.dumps(post_json).encode())
request = QNetworkRequest(url_object)
request.setHeader(QNetworkRequest.ContentTypeHeader, 'application/json') to this (just changed url_object - just a hack not a fix :) ): # Define the request
params = {'access_token': self.key}
authed_url = self._generate_auth_url(url,
params,
)
url_object = QUrl(self.base_url)
self.url = url_object.url()
body = QJsonDocument.fromJson(json.dumps(post_json).encode())
request = QNetworkRequest(url_object)
request.setHeader(QNetworkRequest.ContentTypeHeader, 'application/json') |
huh, really? I use the tool almost every day on localhost and it has never been a problem. And it really shouldn't be, Valhalla ignores query parameters for POST. I'll do the fix though, it's just cleaner anyways. Can you please have a look into the (docker) logs for Valhalla? It should tell what the problem is. Because your request coordinates are definitely not right (valhalla only accepts geodesic). I should find a way to get back the real error message for 400, didn't figure out how to do yet back then. |
BTW, it also prints the coordinates it "transformed" (or not) to the GUI. Or are you using the processing algos? |
And I found out why I had problems at first. My bad :) It is even in my original post: |
aah:) yeah totally overlooked that part of the URL as well.. I experienced that as well, but it felt much more random than that (qgis crashes sooo often for me on arch linux, I thought it might just be another of those individual failures only I experience;)), so your insight proves super valuable! I could reproduce here. Must be in the initialization then, apparently I don't grab the CRS dynamically, which I should of course! Thanks for the input! |
I had the same problem when first firing up the Valhalla plugin. Changed the project SRID to 3301 and then loaded a WMS background. Opened Valhalla plugin and the same url. The error was the same. Token = -. It would still be better if that token is not hard-coded and would be optional. |
@sanderpukk can you update the plugin pls and try again (version 2.2.0)? The fix was approved yesterday night. Again, it really shouldn't be a problem with query parameters. |
I installed it today minutes before posting. After reinstalling the query worked again, but it didnt on the first try. |
so weird.. I really can't reproduce. |
When using your own localhost valhalla the access_token parameter gives http 400 error. Is it possible to make key parameter optional for easier use?
ApiError: (400 (Error transferring http://localhost:8002/route/route?access_token= - server replied: Bad Request))
http://localhost:8002/route/route?access_token=
Parameters:
{ "costing": "auto", "narrative": false, "id": 1, "locations": [ { "lon": 544290.101836, "lat": 6586980.218267 }, { "lon": 658140.446643, "lat": 6472558.717883 } ] }
timing: 0.030 secs
The text was updated successfully, but these errors were encountered: