topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday October 22, 2020, 1:45 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Openstreetmap alias(es)?  (Read 363 times)

orbis

  • Supporting Member
  • Joined in 2017
  • **
  • default avatar
  • Posts: 43
    • View Profile
    • Donate to Member
Openstreetmap alias(es)?
« on: October 10, 2020, 06:02 PM »
I use the FARR Google Maps alias(es) really quite often, but prefer generally to keep away from Google wherever possible.

It would be wonderful if there could be an alias (maps and directions) which harnessed Openstreetmap, instead of Google.

I have no idea where to start on that, so am just throwing it out for anyone who can, to consider!

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,075
    • View Profile
    • Donate to Member
Re: Openstreetmap alias(es)?
« Reply #1 on: October 11, 2020, 02:34 AM »
Do you mean the "maps" alias in FARR's Core-Search.alias? In that case this should do it:

Alias name: OpenStreetMap
Alias regex: ^osm (.*)$
Alias result:
Open Street Map - $$1 | https://www.openstreetmap.org/search?query=$$1

If you also want an icon we can add that like so
Alias result:
Open Street Map - $$1 | https://www.openstreetmap.org/search?query=$$1 /icon=C:\some folder\openstreetmap.ico

The attached zipped openstreetmap.ico was made from this SVG
https://wiki.openstr...-images-osm_logo.svg
put through this convertor
https://favicon.io/favicon-converter/

If you never use the google maps alias you can disable (uncheck) it in the alias settings and then instead use assign the "maps" alias prefix phrase for OpenStreetMap with this regex line
Alias regex: ^maps (.*)$
« Last Edit: October 11, 2020, 02:41 AM by Nod5 »

orbis

  • Supporting Member
  • Joined in 2017
  • **
  • default avatar
  • Posts: 43
    • View Profile
    • Donate to Member
Re: Openstreetmap alias(es)?
« Reply #2 on: October 11, 2020, 02:49 AM »
That is wonderful. It works well! Thank you so much!

Any chance of doing me/us an OSM version of the GM directions alias, with regex? (I know it's an ask, but it would be so helpful!)

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,075
    • View Profile
    • Donate to Member
Re: Openstreetmap alias(es)?
« Reply #3 on: October 11, 2020, 03:32 AM »
Try this

Alias name: OpenStreetMap direction
Alias regex: ^dir (.*) (.*)$
Alias result:
To: $$1 From: $$2 | https://www.openstreetmap.org/directions?to=$$1&from=$$2

Things missing: A way to default the from location to ones current location. Selecting mode of transport (default is car). Such details should be findable on their wiki or help pages
https://help.openstr...-a-parameter-via-url

edit: sorry that gives an error, need to encode the & character. Will update later when more time. My mistake, it does work.

In general if you want to make or tweak these kind of website URL search aliases the keywords to google for is <site name> and URL query or URL search syntax or similar terms. The other thing to try is to type in a search on the website and see if the browser URL changes. Often the pattern to use is visible then. For example if we go to https://www.wikipedia.org/ and search for "ball" the URL changes to https://en.wikipedia.org/wiki/Ball , which means the FARR alias would be something like
alias name: wikipedia
alias regex: ^wiki (.*)$
alias result:
Wiki $$1 | https://en.wikipedia.org/wiki/$$1
« Last Edit: October 11, 2020, 03:47 AM by Nod5 »

orbis

  • Supporting Member
  • Joined in 2017
  • **
  • default avatar
  • Posts: 43
    • View Profile
    • Donate to Member
Re: Openstreetmap alias(es)?
« Reply #4 on: October 11, 2020, 04:23 AM »
Thank you so much for this. See bold below for one unresolved issue.

 Just for clarity:

1) Set up a new custom alias.

2) Call it "dir" [no quote marks].

3) Put in the Results box [without the quote marks]: "Open Street Map - To: $$1 From: $$2 | https://www.openstre...p.org/directions?to=$$1&from=$$2".

3) Put in the Regular Expression Pattern box [no quotes]: "^dir (.*) (.*)$".

4) Form of search =: dir [destination] [from]

See the clip attached.

There is one issue: this formulation doesn't cope with places with more than one word as a name (like New York, for example). Is there a solution to that, do you think?

4wd

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,381
    • View Profile
    • Donate to Member
Re: Openstreetmap alias(es)?
« Reply #5 on: October 11, 2020, 06:51 AM »
There is one issue: this formulation doesn't cope with places with more than one word as a name (like New York, for example). Is there a solution to that, do you think?

Enclose it in quotes: dir "new york" chicago

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,075
    • View Profile
    • Donate to Member
Re: Openstreetmap alias(es)?
« Reply #6 on: October 11, 2020, 06:58 AM »
If you use plus characters "+" instead of spaces then it works as is. For example try searching
dir yonkers+ny long+island+ny
That's because FARR will detect the two parts as whole strings and the website will treat + in the URL as spaces.

Alternatively you can tweak the regex pattern in FARR to require quotes around the to and from strings
alias regex:
^dir "(.*)" "(.*)"$
alias results:
To: $$1 From: $$2 | https://www.openstreetmap.org/directions?to="$$1"&from="$$2"

To use that you would type in the FARR searchbox
dir "yonkers ny" "long island ny"

Note that you can keep both aliases, the one which requires quote marks and the one without, active at the same time. Because only one will trigger depending on if you type the quotemarks or not.

That would look something like this
1.png

and

2.png



« Last Edit: October 11, 2020, 07:05 AM by Nod5 »

orbis

  • Supporting Member
  • Joined in 2017
  • **
  • default avatar
  • Posts: 43
    • View Profile
    • Donate to Member
Re: Openstreetmap alias(es)?
« Reply #7 on: October 11, 2020, 07:25 AM »
Superb, Nod5! Thank you so much!!

wjamoe

  • Supporting Member
  • Joined in 2010
  • **
  • Posts: 99
    • View Profile
    • Donate to Member
Re: Openstreetmap alias(es)?
« Reply #8 on: October 17, 2020, 02:55 AM »
or you can add 'from'  to the alias, then you don't need + signs or quotes in the seach field

regex
dir (.+) from (.+)

in combination with (same as before)
alias result
To: $$1 From: $$2 | https://www.openstre...p.org/directions?to="$$1"&from="$$2"

you can also add ' to'  and ' from' to the alias (please note the use of $$3)

regex
dir (.+) (from|to) (.+)

filter results (to only show the results containing 'to' or 'from'
$$2

directions for $$1 to $$3 | https://www.openstre...p.org/directions?to="$$3"&from="$$1"
directions for $$1 from $$3 | https://www.openstre...p.org/directions?to="$$1"&from="$$3"
directions for $$1 from HOME | https://www.openstre...p.org/directions?to="$$1"&from="HOME ADDRESS"
directions for $$1 from OFFICE | https://www.openstre...p.org/directions?to="$$1"&from="OFFICE ADDRESS"

example

dir segbroeklaan, den haag to schiphol airport
or
dir circuit, zandvoort from home

of course you need to replace HOME ADDRESS with your own home address ;-)