This object is in archive! 
Interface external URLs with position parameters
Completed
Hi Locus wizards.
I would like to add a button to the Locus toolbar that opens an URL with parameters corresponding to the current map position, e.g.
http://www.vttrack.fr/?zoom=11&lat=43.11557&lon=12.35409
Any way to do this?
hm
only http://docs.locusmap.eu/doku.php?id=manual:user_guide:functions:share
hm
only http://docs.locusmap.eu/doku.php?id=manual:user_guide:functions:share
There are at least a dozen very useful trips&tours&track collection websites... gpsies... utagawa... vttrack... all invaluable for planning your trip along the road. You can immediately see which hike/bike/whatever routes are available in a region. One example I gave in the 1st post:
http://www.vttrack.fr/?zoom=14&lat=45.16176&lon=5.67131&layers=OpenCycleMap%7CSentiers%7CTopos%7CUtagawa%7C
Now... when I plan the next day... I normally scroll around in Locus towards the place I want to go and "have a look around". Wouldn't it be great if I could go from Locus to any of these trip sites at the correct position with a single tap?
Then it's another tap on the trip web site to download an interesting track as gpx and import it to Locus.
There are at least a dozen very useful trips&tours&track collection websites... gpsies... utagawa... vttrack... all invaluable for planning your trip along the road. You can immediately see which hike/bike/whatever routes are available in a region. One example I gave in the 1st post:
http://www.vttrack.fr/?zoom=14&lat=45.16176&lon=5.67131&layers=OpenCycleMap%7CSentiers%7CTopos%7CUtagawa%7C
Now... when I plan the next day... I normally scroll around in Locus towards the place I want to go and "have a look around". Wouldn't it be great if I could go from Locus to any of these trip sites at the correct position with a single tap?
Then it's another tap on the trip web site to download an interesting track as gpx and import it to Locus.
Implementing this is straight forward and for a start wouldn't require any user interface at all. Like gynta said... something like
config.cfg:
link1_name="VTT"
link1_url="http://www.vttrack.fr/?zoom={mapzoom}&lat={maplat}&lon={maplon}&layers=OpenCycleMap%7CSentiers%7CTopos%7CUtagawa%7C"
link2_name=...
Support up to 9 link buttons for a start and if they're non-empty, offer them as buttons for your toolbars.
Implementing this is straight forward and for a start wouldn't require any user interface at all. Like gynta said... something like
config.cfg:
link1_name="VTT"
link1_url="http://www.vttrack.fr/?zoom={mapzoom}&lat={maplat}&lon={maplon}&layers=OpenCycleMap%7CSentiers%7CTopos%7CUtagawa%7C"
link2_name=...
Support up to 9 link buttons for a start and if they're non-empty, offer them as buttons for your toolbars.
These "custom link buttons" can also be used to fire position updates to tracking servers or link to google maps or to any other URL-controlled thingy out there... probably thousands of options.
Parameters... more can be added later:
maplat - map center latitude
maplon - map center longitude
mapzoom - map zoom (maybe needs another variant)
mapleft - left edge of map (longitude)
mapright - right edge of map (longitude)
maptop - top edge of map (latitude)
mapbottom - bottom edge of map (latidue)
gpslat
gpslon
gpsspeed
gpsalt
gpstime
utctime
systemtime
trackname - name of (last) selected track
...
With {trackname} parameter, I could e.g. add a custom button that would launch a google search for the track name. Why is that useful? Because when you download tracks from trip portals, they unfortunaley mostly lack any sort of description. By googling the track name, I can normally find this description in the trip portal again when I need to.
These "custom link buttons" can also be used to fire position updates to tracking servers or link to google maps or to any other URL-controlled thingy out there... probably thousands of options.
Parameters... more can be added later:
maplat - map center latitude
maplon - map center longitude
mapzoom - map zoom (maybe needs another variant)
mapleft - left edge of map (longitude)
mapright - right edge of map (longitude)
maptop - top edge of map (latitude)
mapbottom - bottom edge of map (latidue)
gpslat
gpslon
gpsspeed
gpsalt
gpstime
utctime
systemtime
trackname - name of (last) selected track
...
With {trackname} parameter, I could e.g. add a custom button that would launch a google search for the track name. Why is that useful? Because when you download tracks from trip portals, they unfortunaley mostly lack any sort of description. By googling the track name, I can normally find this description in the trip portal again when I need to.
This might all just sound like a "gimmick" to people who come home every night and do their trip planning on a PC. But when you're away for longer with just your smartphone, things start to look different.
This might all just sound like a "gimmick" to people who come home every night and do their trip planning on a PC. But when you're away for longer with just your smartphone, things start to look different.
To me this idea seems one of those where in the beginning we can't image all possible use cases, but once it's implemented, people may come up with creative ideas how to use it beyond our current imagination.
It's also rather simple to implement, I guess, and it'll not disturb those who don't need it, so I voted in favor of it.
To me this idea seems one of those where in the beginning we can't image all possible use cases, but once it's implemented, people may come up with creative ideas how to use it beyond our current imagination.
It's also rather simple to implement, I guess, and it'll not disturb those who don't need it, so I voted in favor of it.
Here's another possible and fancy usage: Locus checks the http result of the URL on click. If mime type is gpx/kml/kmz, download & save the result to "Locus/data/temp/{buttonname}.gpx/kml/kmz" and then display it (like map items) instantly.
Result? We could http query any kind of geo data (weather, wind, volcano activity, thunderstorms, whatever) and have instant visual result on our maps.
Here's another possible and fancy usage: Locus checks the http result of the URL on click. If mime type is gpx/kml/kmz, download & save the result to "Locus/data/temp/{buttonname}.gpx/kml/kmz" and then display it (like map items) instantly.
Result? We could http query any kind of geo data (weather, wind, volcano activity, thunderstorms, whatever) and have instant visual result on our maps.
Menion ● 17 hours ago:
>Hmm interesting. Have to say .... why not.
>Find at least ten votes (ten people who find this useful) and I'll look at it.
no comment.. :D
Menion ● 17 hours ago:
>Hmm interesting. Have to say .... why not.
>Find at least ten votes (ten people who find this useful) and I'll look at it.
no comment.. :D
Nice idea. I support this.
Greetings jusc
Nice idea. I support this.
Greetings jusc
Still collecting votes? Come on... Its already more than twice the number you asked for :)
Still collecting votes? Come on... Its already more than twice the number you asked for :)
I just thought there'd be a state change in the topic when the "required vote count" is reached... but maybe I still didn't get the hang of this web 2.0 voting/liking stuff... sorry... still an old "forum guy"... :).
I just thought there'd be a state change in the topic when the "required vote count" is reached... but maybe I still didn't get the hang of this web 2.0 voting/liking stuff... sorry... still an old "forum guy"... :).
Version 3.10.3.1 - BETA - first test of this feature
Main menu > More > first button "Quick URI request"
Reusing of live-tracking system is unfortunately more complicated, then writing it from scratch, which will be better solution due to future flexibility. Only help was reusing of small part of "Quick add point" feature.
Version 3.10.3.1 - BETA - first test of this feature
Main menu > More > first button "Quick URI request"
Reusing of live-tracking system is unfortunately more complicated, then writing it from scratch, which will be better solution due to future flexibility. Only help was reusing of small part of "Quick add point" feature.
First test was ok with exists vars
About time:
Server has received eg "2015-07-08 23:59:41:729+0200"
or
"{timeUtc}"
I'm able to give a format?
First test was ok with exists vars
About time:
Server has received eg "2015-07-08 23:59:41:729+0200"
or
"{timeUtc}"
I'm able to give a format?
Nice... wish I had a config.cfg interface and could use a proper editor instead of cumbersome android text fields :). Editing an existing entry only works very rarely here. Most of the time, when I change the URI and hit OK, nothing happens. The OK button blinks shortly but the window stays open and nothing is changed. I can only close it with X and lose my edits.
Nice... wish I had a config.cfg interface and could use a proper editor instead of cumbersome android text fields :). Editing an existing entry only works very rarely here. Most of the time, when I change the URI and hit OK, nothing happens. The OK button blinks shortly but the window stays open and nothing is changed. I can only close it with X and lose my edits.
Text editors are just good at what they do... editing text. You wouldnt edit your source code in an Android text field would you? :)
Anyway... I can understand that config.cfg is not usable in general for public features. Never mind.
Valid URL seems to be the problem... I cannot add a vertical line in a parameter, like layers=Utagawa|GPSies . Then Locus refuses to OK.
Text editors are just good at what they do... editing text. You wouldnt edit your source code in an Android text field would you? :)
Anyway... I can understand that config.cfg is not usable in general for public features. Never mind.
Valid URL seems to be the problem... I cannot add a vertical line in a parameter, like layers=Utagawa|GPSies . Then Locus refuses to OK.
Hi menion.
Could you please add the current views bounding box as possible parameters? Like
{mapNorth} {mapSouth} {mapEast} {mapWest} ?
I know there is center and zoom, but that doesn't allow talking to OSM overpass api nicely. They want a bounding box.
Hi menion.
Could you please add the current views bounding box as possible parameters? Like
{mapNorth} {mapSouth} {mapEast} {mapWest} ?
I know there is center and zoom, but that doesn't allow talking to OSM overpass api nicely. They want a bounding box.
Oki, understand. Added.
Oki, understand. Added.
http://overpass-turbo.eu is a really powerwul thingy that allows extraction of all kinds of OSM data in realtime. With a little more support from Locus, this could turn into a powerful tool. We could e.g. define a "Watersources" button and have Locus immediately show all water sources in the current map view as waypoints. That would work on all kinds of maps, OSM or not, on all zoom levels, regardless if the render theme displays those things prominently or not.
Locus has all the stuff required for this already, it only needs to be tied together properly:
Don't fire up a web browser but download the result data from the constructed URL and store it (silent overwrite) in
/Locus/mapItems/wwwbookmarks/{bookmarkName}.resultMimeType
If resultMimeType is gpx/kml/kmz (or anything else that Locus understands), auto-enable that file as a map item.
Done.
Dozens of cool uses for such shortcuts spring to mind. Imagine e.g. traveling to Gran Canaria and wanting to find out where all the easy rated mountainbike trails are. A click on the (predefined) "mtbscale-S0" and the "mtbscale-S1" buttons will get you there, instead of teadiously and manually scrolling across the whole island in a detailed zoom level.
The distinction if Locus should fire up a web browser or download the result data directly could either be made by an option in the url bookmarks edit window, or by prepending "download:" to the url string, or maybe even automagically: You try downloading the URL first... if its mimeType is gpx/kml/kmz you switch to mapItems handling, if not you fire up a browser.
http://overpass-turbo.eu is a really powerwul thingy that allows extraction of all kinds of OSM data in realtime. With a little more support from Locus, this could turn into a powerful tool. We could e.g. define a "Watersources" button and have Locus immediately show all water sources in the current map view as waypoints. That would work on all kinds of maps, OSM or not, on all zoom levels, regardless if the render theme displays those things prominently or not.
Locus has all the stuff required for this already, it only needs to be tied together properly:
Don't fire up a web browser but download the result data from the constructed URL and store it (silent overwrite) in
/Locus/mapItems/wwwbookmarks/{bookmarkName}.resultMimeType
If resultMimeType is gpx/kml/kmz (or anything else that Locus understands), auto-enable that file as a map item.
Done.
Dozens of cool uses for such shortcuts spring to mind. Imagine e.g. traveling to Gran Canaria and wanting to find out where all the easy rated mountainbike trails are. A click on the (predefined) "mtbscale-S0" and the "mtbscale-S1" buttons will get you there, instead of teadiously and manually scrolling across the whole island in a detailed zoom level.
The distinction if Locus should fire up a web browser or download the result data directly could either be made by an option in the url bookmarks edit window, or by prepending "download:" to the url string, or maybe even automagically: You try downloading the URL first... if its mimeType is gpx/kml/kmz you switch to mapItems handling, if not you fire up a browser.
Just for testing... the supercharged shortcut buttons could do something like this... on a single tap... right inside Locus... where it belongs:
http://overpass-turbo.eu/s/dRb
Just for testing... the supercharged shortcut buttons could do something like this... on a single tap... right inside Locus... where it belongs:
http://overpass-turbo.eu/s/dRb
I was also thinking about something like this (Locus not opening a browser, but doing the http request by itself and use the returned data directly) some time ago.
But this would require overpass to have an option to return gpx/kml/kmz directly, which I have not found yet.
As far as I know, overpass can generate this filetypes, but only after manually clicking export on the overpass website!?
I only found this:
http://overpass-api.de/output_formats.html
None of this output options is supported by Locus directly, I think.
Does anybody have a clue how this could work?
I was also thinking about something like this (Locus not opening a browser, but doing the http request by itself and use the returned data directly) some time ago.
But this would require overpass to have an option to return gpx/kml/kmz directly, which I have not found yet.
As far as I know, overpass can generate this filetypes, but only after manually clicking export on the overpass website!?
I only found this:
http://overpass-api.de/output_formats.html
None of this output options is supported by Locus directly, I think.
Does anybody have a clue how this could work?
Setting up a simple json2gpx.php on some random server is a matter of one hour maybe. The URL for Locus shortcut buttons would look somewhat like this then:
http://randomserver.de/geojson2gpx.php?json=http://overpass-api.de/api/interpreter?data=<overpassquery>
Setting up a simple json2gpx.php on some random server is a matter of one hour maybe. The URL for Locus shortcut buttons would look somewhat like this then:
http://randomserver.de/geojson2gpx.php?json=http://overpass-api.de/api/interpreter?data=<overpassquery>
Ok, this of course possible. I was searching for a solution without using another server.
Maybe this will be supported by overpass sometimes in the future.
Meanwhile, if you happen to implement such a converter script, I hope you don't mind sharing it ;-)
Ok, this of course possible. I was searching for a solution without using another server.
Maybe this will be supported by overpass sometimes in the future.
Meanwhile, if you happen to implement such a converter script, I hope you don't mind sharing it ;-)
Sure.... but since this topic is "completed", don't get your hopes up. Urlbookmarks might go down the same road as many other things in Locus: Could have been useful but were terminated just two manhours too early :-).
Another example for this: "map items" could totally rock if they were simply and silently auto-updating on file modification. We could have done many nifty things with this... like auto-syncing data with friends... displaying new pictures as soon as they are taken... even buddy tracking without external servers and emailing random people on random forums.
Oh... and if map items were auto-updating already, doing this little addition here to urlbookmarks would be two lines of code more or less. Maybe twelve if you wrap it in a separate non-blocking thread, where all network stuff belongs.
Sure.... but since this topic is "completed", don't get your hopes up. Urlbookmarks might go down the same road as many other things in Locus: Could have been useful but were terminated just two manhours too early :-).
Another example for this: "map items" could totally rock if they were simply and silently auto-updating on file modification. We could have done many nifty things with this... like auto-syncing data with friends... displaying new pictures as soon as they are taken... even buddy tracking without external servers and emailing random people on random forums.
Oh... and if map items were auto-updating already, doing this little addition here to urlbookmarks would be two lines of code more or less. Maybe twelve if you wrap it in a separate non-blocking thread, where all network stuff belongs.
Tested the new boundingbox parameters for WWW-Bookmarks, working as expected! Thanks!
So what do you think about an option to request the URL (and download the result, e.g. to MapItems-Folder) directly in Locus instead of calling an external browser?
joeloc already asked for this. Together with the new MapItems auto-update, this would be a very handy and flexible way to request and display dynamic data from the internet!
Tested the new boundingbox parameters for WWW-Bookmarks, working as expected! Thanks!
So what do you think about an option to request the URL (and download the result, e.g. to MapItems-Folder) directly in Locus instead of calling an external browser?
joeloc already asked for this. Together with the new MapItems auto-update, this would be a very handy and flexible way to request and display dynamic data from the internet!
I just hacked a little php to translate overpass json api output to gpx on the fly.
When used within url bookmarks in Locus, it opens an Opera browser which displays the gpx file in XML notation. Not very useful for now. I guess it's menions turn again to download this instead of open a browser, save it, use it as mapitem, all automagically. Should be quite straight forward.
hmm... sorry... this editor here goes totally crazy when I try to insert my example URLs...
http://tinyurl.com/zqpfavo
for an example. Sorry for the tinyurl stuff... but I really cannot paste complex urls in this editor. It majorly messes them up. See screenshot below for Locus settings. My script parses the json tracks from overpass into a gpx file with one waypoint per track, name is mtb:scale difficulty, desc is all other osm properties. Obviously only an example, will add more options as soon as we find a way to get the data into Locus without major headaches (= without any other clicks)
I just hacked a little php to translate overpass json api output to gpx on the fly.
When used within url bookmarks in Locus, it opens an Opera browser which displays the gpx file in XML notation. Not very useful for now. I guess it's menions turn again to download this instead of open a browser, save it, use it as mapitem, all automagically. Should be quite straight forward.
hmm... sorry... this editor here goes totally crazy when I try to insert my example URLs...
http://tinyurl.com/zqpfavo
for an example. Sorry for the tinyurl stuff... but I really cannot paste complex urls in this editor. It majorly messes them up. See screenshot below for Locus settings. My script parses the json tracks from overpass into a gpx file with one waypoint per track, name is mtb:scale difficulty, desc is all other osm properties. Obviously only an example, will add more options as soon as we find a way to get the data into Locus without major headaches (= without any other clicks)
Since the complete URL as parameter only caused major headaches, you can now simply pass data=... to my script as well. It is directly sent overpass-api. So here's finally a working example to copypaste into your www bookmark config:
http://www.alpenzorro.de/overpass2gpx.php?data=[out:json][timeout:25];(way["mtb:scale"~"[0123456]"]({screenLatBottom},{screenLonLeft},{screenLatTop},{screenLonRight}););out%20body;>;out%20skel%20qt;
Since the complete URL as parameter only caused major headaches, you can now simply pass data=... to my script as well. It is directly sent overpass-api. So here's finally a working example to copypaste into your www bookmark config:
http://www.alpenzorro.de/overpass2gpx.php?data=[out:json][timeout:25];(way["mtb:scale"~"[0123456]"]({screenLatBottom},{screenLonLeft},{screenLatTop},{screenLonRight}););out%20body;>;out%20skel%20qt;
So far so good... I can click on my URL bookmark now, a web browser opens and is forced into downloading "test.gpx" by my script using an unknown mime type. Then test.gpx can be imported manually into Locus to get the data. On subsequent calls, this will be test-1.gpx, test-2.gpx etc (depending on Browser) and obviously this turns into a major headache until the data is in Locus.
To make this all worthwile, Locus needs to support direct downloading instead of browser launching. The filename should be something like mapitems/bookmarks/<bookmarkname>.<ending> . Not sure what the best practice would be here and where to get the ending from. I could return a header like
'Content-Disposition: attachment; filename="overpass.gpx"
Could you read this easily? And maybe prepend <bookmarkname>?
The idea here is to have lots of pre-configured bookmarks shipping with Locus, eg
"Singletracks"
"Watersources"
"Bikeshops"
etcpp.
On tap, they should then produce "mapItems/bookmarks/Singletracks.gpx" etc and auto-enable that as map item. On next taps, the file needs to be quietly overwritten and updated.
So far so good... I can click on my URL bookmark now, a web browser opens and is forced into downloading "test.gpx" by my script using an unknown mime type. Then test.gpx can be imported manually into Locus to get the data. On subsequent calls, this will be test-1.gpx, test-2.gpx etc (depending on Browser) and obviously this turns into a major headache until the data is in Locus.
To make this all worthwile, Locus needs to support direct downloading instead of browser launching. The filename should be something like mapitems/bookmarks/<bookmarkname>.<ending> . Not sure what the best practice would be here and where to get the ending from. I could return a header like
'Content-Disposition: attachment; filename="overpass.gpx"
Could you read this easily? And maybe prepend <bookmarkname>?
The idea here is to have lots of pre-configured bookmarks shipping with Locus, eg
"Singletracks"
"Watersources"
"Bikeshops"
etcpp.
On tap, they should then produce "mapItems/bookmarks/Singletracks.gpx" etc and auto-enable that as map item. On next taps, the file needs to be quietly overwritten and updated.
Obviously this could work for many other things as well, if we have it flexible enough. I am pretty sure there are e.g. Panoramio or Flickr URLs to query that kind of data...
Obviously this could work for many other things as well, if we have it flexible enough. I am pretty sure there are e.g. Panoramio or Flickr URLs to query that kind of data...
I rely appreciate the way the topic is followed up !
I can see some great progress coming up, if you guys put together your knowledge.
I rely appreciate the way the topic is followed up !
I can see some great progress coming up, if you guys put together your knowledge.
@joeloc: Just to give me a little deeper understanding:
Overwriting the "mapItems/bookmarks/Singletracks.gpx" will not overwrite my former mapitems (eg Waypoints)?
@joeloc: Just to give me a little deeper understanding:
Overwriting the "mapItems/bookmarks/Singletracks.gpx" will not overwrite my former mapitems (eg Waypoints)?
Script test run to find all mountainbike singletracks on Gomera. This is really quite useful if you dont know the area. You can immediately figure out if and where it makes sense to go.
Of course mapsforge will also render singletrack scales on higher zoom levels, but you would have to tediously scroll across the whole island to find out whats going on.
Script test run to find all mountainbike singletracks on Gomera. This is really quite useful if you dont know the area. You can immediately figure out if and where it makes sense to go.
Of course mapsforge will also render singletrack scales on higher zoom levels, but you would have to tediously scroll across the whole island to find out whats going on.
menion... if you happen to be working on direct download... you can test with different mime types by using mime parameter, eg
http://www.alpenzorro.de/overpass2gpx.php?mime=application/xml&data=[out:json][timeout:25];(way["mtb:scale"~"[0123456]"]({screenLatBottom},{screenLonLeft},{screenLatTop},{screenLonRight}););out%20body;>;out%20skel%20qt;
menion... if you happen to be working on direct download... you can test with different mime types by using mime parameter, eg
http://www.alpenzorro.de/overpass2gpx.php?mime=application/xml&data=[out:json][timeout:25];(way["mtb:scale"~"[0123456]"]({screenLatBottom},{screenLonLeft},{screenLatTop},{screenLonRight}););out%20body;>;out%20skel%20qt;
Replies have been locked on this page!