esm7 / obsidian-map-view

Interactive map view for Obsidian.md
MIT License
612 stars 32 forks source link

Mislocation #57

Closed RenaudSav closed 2 years ago

RenaudSav commented 2 years ago

I've been looking for a GIS solution like this for a while, and was very thrilled to give Obsidian Map a try, but I have the following issue : after copy-pasting an address from Google Maps into Obsidian, the link in Obsidian leads to an point on the map or in Google Maps which is a few blocks off the right (original) address in Google Maps... I tried with several adresses, including my home. The Geocoding search provider is the default one (OpenStreetMap).

Copied (original) address

Copied (original) address

Obsidian link Obsidian link

Address to where the Obsidian link leads

Address to where the Obsidian link leads
RenaudSav commented 2 years ago

Additional comment : here attached a screen capture showing the coordinates before/after geolocation conversion (geosearch). The coordinates are slightly different, why that ? And how can I fix it ?

Before:after geolocation conversion (geosearch)-

esm7 commented 2 years ago

Hey, There is indeed an issue with the parsing from Google Maps that somehow I didn't notice so far. More than a bug, it's a misinterpretation of what the URL in Google Maps actually represents. Turns out that it does not represent the chosen location, but the active view, so the coordinates are off from where you meant by a distance that's relative to the zoom level. Until I find a better way to accomplish the original intent, I recommend that you define a custom URL parsing rule for raw lat, lng coordinates: ([0-9\.\-]+), ([0-9\.\-]+) Then in Google Maps, don't copy the URL, but rather the coordinates of a point. If you right-click a point in Google Maps Web, the first entry in the popup copies the coordinates to the clipboard, and then you can use "Paste as Geolocation" in Map View (after defining the custom parsing rule above) to enter the location, or paste it to the box in "new geolocatio note". Let me know if this works for you.

esm7 commented 2 years ago

2022-02-24_15-04

RenaudSav commented 2 years ago

Hey,

Thanks for your answer 😊

There is indeed an issue with the parsing from Google Maps that somehow I didn't notice so far.

Yes, it’s not a concern when locating the Yellowstone National Park, only noticeable with precise urban addresses.

More than a bug, it's a misinterpretation of what the URL in Google Maps actually represents. Turns out that it does not represent the chosen location, but the active view, so the coordinates are off from where you meant by a distance that's relative to the zoom level.

I get it, though I tried both : copy from the URL, and copy from the pin on a map. Doesn’t work either.

Until I find a better way to accomplish the original intent, I recommend that you define a custom URL parsing rule for raw lat, lng coordinates: ([0-9.-]+), ([0-9.-]+)

Hmm.. this I don’t get this one, where and how should I set this ? I’m not a developer, just an average user, and not very familiar with html and URLs. So I don’t know how to define a custom URL pasting rule, and don’t understand the ([0-9.-]+), ([0-9.-]+) formula.. I need your help there.

Renaud Savignard @.*** +33 (0)608223634

Le 24 févr. 2022 à 14:05, esm7 @.***> a écrit :

Hey, There is indeed an issue with the parsing from Google Maps that somehow I didn't notice so far. More than a bug, it's a misinterpretation of what the URL in Google Maps actually represents. Turns out that it does not represent the chosen location, but the active view, so the coordinates are off from where you meant by a distance that's relative to the zoom level. Until I find a better way to accomplish the original intent, I recommend that you define a custom URL parsing rule for raw lat, lng coordinates: ([0-9.-]+), ([0-9.-]+) Then in Google Maps, don't copy the URL, but rather the coordinates of a point. If you right-click a point in Google Maps Web, the first entry in the popup copies the coordinates to the clipboard, and then you can use "Paste as Geolocation" in Map View (after defining the custom parsing rule above) to enter the location, or paste it to the box in "new geolocatio note". Let me know if this works for you.

— Reply to this email directly, view it on GitHub https://github.com/esm7/obsidian-map-view/issues/57#issuecomment-1049838964, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXREPE7AFVTGVHG4FUV4OQ3U4YUKZANCNFSM5O7DX5PA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

RenaudSav commented 2 years ago

Additional info/testing : locations coordinates from OpenStreetMaps, once copied and pasted as raw text, then converted, are at the right location when opened... even when opened in Google Maps. Which means that :

esm7 commented 2 years ago

Hey Renaud, To add a URL parsing rule, go to the plugin settings (under Obsidian's Settings -> Map View), then scroll down to the section named "URL Parsing Rules". Click on "New Parsing Rule". In the Name field enter whatever you'd like (e.g. "Coordinates") and in the box named "Regex with 2 capture groups" copy this: ([0-9\.\-]+), ([0-9\.\-]+) After setting this, you should be able to copy raw coordinates from Google Maps and use the Paste as Geolocation function with them.

RenaudSav commented 2 years ago

Thanks,

I’ve set this rule and just tried :

So it seems to be OK except that :

BTW, how is the right sparse rule selected for conversion ? I now have three (see attached). According to the address format I guess ?

Thanks for your help !!

Cheers

Renaud Savignard @.*** +33 (0)608223634

Le 28 févr. 2022 à 17:59, esm7 @.***> a écrit :

Hey Renaud, To add a URL parsing rule, go to the plugin settings (under Obsidian's Settings -> Map View), then scroll down to the section named "URL Parsing Rules". Click on "New Parsing Rule". In the Name field enter whatever you'd like (e.g. "Coordinates") and in the box named "Regex with 2 capture groups" copy this: ([0-9.-]+), ([0-9.-]+) After setting this, you should be able to and use the Paste as Geolocation function with them.

— Reply to this email directly, view it on GitHub https://github.com/esm7/obsidian-map-view/issues/57#issuecomment-1054463463, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXREPE6O65U5RAEGC36MLJ3U5OSYNANCNFSM5O7DX5PA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

esm7 commented 2 years ago

Can you take screenshots of:

  1. The new URL parsing rules as you set them
  2. How your note looks after pasting the raw coordinates from Google Maps And when you write "convert to geolocation: OK", what do you mean? Do you right-click the pasted text and "convert to geolocation" from the menu works?

To your question, the parsing rules are attempted by their order. If you copied the raw location from Google Maps, only the new (3rd) rule should match.

RenaudSav commented 2 years ago

Can you take screenshots of:

The new URL parsing rules as you set them How your note looks after pasting the raw coordinates from Google Maps Hereattached pdf

Original GoogleMaps location (red pin) :

And when you write "convert to geolocation: OK", what do you mean? Do you right-click the pasted text and "convert to geolocation" from the menu works? Yes To your question, the parsing rules are attempted by their order. If you copied the raw location from Google Maps, only the new (3rd) rule should match.

OK — Reply to this email directly, view it on GitHub https://github.com/esm7/obsidian-map-view/issues/57#issuecomment-1054531762, or unsubscribe https://github.com/notifications/unsubscribe-auth/AXREPE6P73OAC7LPB2R2KWLU5O3WZANCNFSM5O7DX5PA. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you authored the thread.

RenaudSav commented 2 years ago

UPDATE

And when you write "convert to geolocation: OK", what do you mean? Do you right-click the pasted text and "convert to geolocation" from the menu works? Yes Sorry, in fact no : I paste as raw text, (no other option, see video : https://www.loom.com/share/193d44787e624722af56ab77648f958e)

esm7 commented 2 years ago

The attachments didn't work.

esm7 commented 2 years ago

Updated the default URL parsing and removed the faulty Google Maps one in version 1.4.0. Thanks for the help with this!