-
-
Notifications
You must be signed in to change notification settings - Fork 113
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
Add support for OpenStreetMap #15
Comments
Here are some other projects with this function (haven't tested them yet): |
Hi @ToughGuyKunio that's an excellent idea, I'll look into it. |
This is a bit harder than I first thought, I think redirecting URLs won't be too much of a problem, almost got this working, but embedded maps seem to be a problem, not sure how to do this as it appears they are most often not just done using an iframe but rather by the Google Maps API instead. |
I found this repo which achieves the switch for iframe embedded maps, might be a place to start. But I think for initial support I'll just do the URL redirection instead. |
@ToughGuyKunio I've pushed an update to a new branch entitled osm-redirect, did you want to build the extension from this new branch and test it out in your browser? It's still a work in progress but I'd appreciate some feedback if you are able to. |
I pushed new Firefox build if you want to try that instead (v1.1.10) couldn't get the embedded redirects working so I disabled them for now. |
Found this site to test a few different link types: https://stackoverflow.com/questions/1300838/how-to-convert-an-address-into-a-google-maps-link-not-map
Edited: updated with ver. 1.1.12 |
Hmm still needs some work, not sure how many different iterations there are of the URL scheme, thanks for the feedback @ToughGuyKunio let me know if you find any others. |
@ToughGuyKunio new version pushed to the AMO (v1.1.11) should work for these URLs now. |
Do you happen to know where we could find a list of alternative OSM instances? |
Yes most seems to work now, just found one that I missed before that doesn't seem to work: Edited: updated with ver. 1.1.12 I'm not aware of any instances, I think it's run more like Wikipedia in that it doesn't really support instances. Also, huge thanks for implementing this! |
Also this link with spaces only seems to work sometimes for me:
Edited: updated with ver. 1.1.12 |
Found this: https://developers.google.com/maps/documentation/urls/guide
Seems there's no end to URL variants :) Edited: updated with ver. 1.1.12 |
Yeah it looks like I made a mistake with the last build, broke some that were working before, just fixing it up now. |
Oh and some of those look to be directions links which I haven't handled at all yet. |
This seems to be something like instances: https://wiki.openstreetmap.org/wiki/Tile_servers |
@ToughGuyKunio I don't think the directions URLs are going to work, it seems OSM relies on latitude longitude values for
This is actually the same issue I'm facing with the embedded maps, OSM must have latitude longitude values for embedded maps also. Not sure how we can get past this issue for both these use cases. |
I think I'll need to do an address lookup from the plugin using OSM, if they have such an API, and use the results to populate the latitude longitude values. Not sure how accurate that would be even if it was possible though. This is turning out to be a big job... EDIT - There is an API which looks to do exactly what I want here. |
Sadly I don't have any coding skills, otherwise I would help you out. Minor possible improvement: In Google Maps zoom level seems to be indicated by either Example:
Edited: updated with ver. 1.1.13 I've added some checkboxes to keep track on what URLs currently work. |
Thanks @ToughGuyKunio this all actually helps a lot, hopefully by the end we will have a fairly robust solution. I grab the zoom level from the Google link if available, most of the time it appears to not be present though so perhaps I can add Also on the API solution I mentioned above the extension will have to make a request to the OSM geocoding service to get the lat long of the address text, this could slow down the redirect considerably but I guess we'll wait and see how it goes when we do some testing. Got to do some paying work now unfortunately but perhaps I can look into this further this afternoon. Thanks again for your help! |
@ToughGuyKunio released a new version (1.1.12) on AMO which includes support for directions and embeds, although the embeds may need some more work... |
Nice! I've updated the checkboxes for all links. The zoom level, when it's not present in URL, on Google Maps appears to be anywhere between 10-17, from some testing |
Queries don't seem to display as a marker on OSM, just a map centred on that location.
I don't think there is an equivalent on OSM to load up a map at your current location, I know there is a button to the right that allows it but I don't think there is a way to do it via a URL.
Yeah I still need to look at the zoom stuff, try default it to something if it's not present. |
New version should be live on AMO shortly with the default zoom (17) and a fix for the embedded maps, noticed that they weren't showing the bounds correctly. |
I can't seem to get any embedded maps to load in Firefox, might be my configuration.
Edit: just tested with a brand new Firefox installation, same problem, all iframe are blank. Here's what I've tested:
|
Support for embedded maps only works with Google's Maps Embed API (using Try one like this https://www.google.com/maps/embed/v1/place?q=Sydney+NSW+Australia&key=... To get the JS API to work I'd need to perhaps bundle some of the Google JS assets in the extension to build the iframe and then do the switch after that, not sure how feasible this approach is though... |
Yes the problem here is that OSM has set options in the header of their responses that don't allow their site to be loaded in an iframe, the only way to load their site in an iframe is by using their Seems much more work is needed on this... |
Thanks @ToughGuyKunio I'll look into Street view and layers too. |
@ToughGuyKunio new build released on AMO, includes support for layers, and that viewport workaround you suggested. |
Every redirect I've tried now works and I've got no more suggestions. |
Awesome! Was actually pretty interesting to work on this one, I really like OSM now that I've learned a little more about it, certainly going to try use it in some other projects going forward. Thanks heaps for the suggestion and help here, all your input was very helpful. |
Add OpenStreetMap (OSM) as a privacy alternative to Google Maps (and potentially other map services).
The text was updated successfully, but these errors were encountered: