vincentneo / Avenue-GPX-Viewer

A simple and easy GPX viewer for macOS.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature suggestion: copy coordinates of a point on the map

jollino opened this issue · comments

Hello dev,
first of all thanks for the nice app!

I have a little feature suggestion that I think may come in handy for others as well: being able to copy the coordinates of an arbitrary point on the map. This could be achieved with a small contextual menu (which could also show the coordinates as a greyed-out item for a quick glance), or maybe just clicking with the right/secondary mouse button.

My personal use case is that I love driving aimlessly and my dashcam records GPX tracks. I often go through the route again on the map and want to see what the Street View and/or Look Around imagery look like for a specific area, and being able to quickly extract the coordinates of a point of my route — or really any point around where I've been — would allow me to use Avenue as my go-to GPX viewer.
I currently fall back to GPXSee for that, but it has a few speed issues on retina screens (not the devlopers' fault, it's an issue with QT on macOS). Avenue is way smoother when panning and zooming around, being a native and modern app.

I would go for a PR, but I'm definitely not proficient enough in Swift and macOS development to even know where to put my hands. :-)

Sounds like a cool feature to add!
Dropping pins around and reading the coordinates right?

Sorry for the long delay, btw.

No worries, life can and does get in the way. :-)
Yep, dropping pins around would be a good approach, ideally showing the coordinates without an extra step (a pop-over maybe?) or just when right-clicking like Google Maps does. In GM, clicking the coordinates in the menu copies them to the clipboard.
Or perhaps just having a label somewhere showing the current coordinates under the mouse pointer, which would make it even more immediate for a quick glance. Maybe in that case Command-C may be used to copy them, since it's currently unused and would be a very instinctive gesture.

Once again, thank you so much for this project. It's really great to see "real" Mac apps still being developed, in a world of Catalyst and Electron stuff.

As a slight OT, I see you also develop on iOS. I've been thinking about what I think would be a neat map-related app… at least for a nerd like me, I suppose. I'd be happy to share the idea, as I just don't have the time to go back to developing apps myself. (I did that back when ObjC 2.0 with ARC was a new thing, which feels about two and a half lifetimes ago.)

I think I got what you mean clearly now, and yes, I think it can be done.

Once again, thank you so much for this project. It's really great to see "real" Mac apps still being developed, in a world of Catalyst and Electron stuff.

I myself am a big fan of real, fully native Mac apps too, so I'll keep this going (along with my other Mac apps) :)

And yes, I do develop iOS apps. Would be happy to hear the idea. Some codes of this project actually originated from merlos/iOS-Open-GPX-Tracker.

I've actually been using that GPX tracker. It's really great that there are nice open source apps for iOS, despite it being a "closed" environment!

My map-app (mapp?!) idea comes from my penchant for driving around looking for interesting things, so I'm not sure how popular it would be with other people.
When looking back at the GPX tracks from my GPS-equipped dashcam — or an app like the one you linked above :D — I often notice that I was close to something worth going to, but I just didn't know about it and didn't think about checking. My thinking is: wouldn't be nice if I could delegate that to someone else? When playing GTA Online, that's exactly how it works. If you're in the driver's seat, other people in the same car can set a destination on their GPS and it'll show up on yours, which comes in very handy as you can't really stop and fiddle with the map while you're being chased by police, shot at by rivals, or whatever. Hopefully that's not also happening in real life :D but it would be cool if someone could be exploring the map on their own device and sending a destination to your navigation app.

To prove that I've given this some serious thought, here's how far I've come with planning an implementation. Let's call this the "co-pilot app", just for clarity, as opposed to "navigation apps" such as Apple Maps, Google Maps, etc.

The most obvious system would be to use Airdrop, which has the convenient side effect of automatically opening files in the "correct" app according to the UTI (unless you have multiple apps for the same UTI, in which case it asks). Since you're driving, that would help making the experience seamless from your point of view.
The problem with that is that there are many navigation apps that people use, so forcing a specific one may not be ideal. I generally prefer Waze but I've been trying AmiGO lately, and avoid Google Maps and Apple Maps because they let the device sleep if you don't set a destination and start routing. Obviously in this specific case we do want to have a destination for routing, but I'd rather keep using Waze or Amigo than be forced into an environment I'm not familiar with... especially in areas I'm not familiar with.

So this co-pilot app, when in "receiving" mode, should have a setting to choose which navigation app to use. When a payload is received via AirDrop, the co-pilot app should pass the coordinates to the chosen navigation app. Of course, at that point it's up to the other app to start navigation without requiring any other input, but that's something that can't really be changed. Tapping "Start" shouldn't be much of an issue, and there's also the person who sent the coordinates to start routing on the receiving device, once it's opened by this magic co-pilot app.

The other side of the coin is the co-pilot app in "sending" mode. Here there are various options: it could get map tiles from various sources (OSM, MapBox, Apple Maps, Google Maps, etc. as far as the APIs allow, anyway) so that exploring can take place within the co-pilot app itself. That would make it much easier to select a point, serialize it somehow into an object that can be sent via AirDrop, and the co-pilot app on the receiving device would immediately know how to handle it.

I'm saying that because I've tried looking at what Apple Maps and Google Maps send out when you "share" a location from them, using an iOS app called "Pb Buddy". Both send a URL, but while Apple Maps is explicit [1] (public.url), Google Maps used a shortened format [2] (public.utf8-plain-text). Unshortening it is as easy as trying to open it and following the first 302 redirect [3] (there are multiple ones, including a consent wall), but the format may change.
Other apps use their own format rather than just sharing the coordinates (e.g. Organic Maps has some text, and two URLs [4], which look like an encoded version of the coordinates). Getting them right may require some heuristics and just handling them explicitly one by one, much like yt-dlp does for extractors, so an easier approach would be to just have the co-pilot app show a map (be it via MKMapView or some other API, possibly both) and handle the "sending" part directly.

To recap:

  1. The Navigator user uses the co-pilot app to find a spot to go to
  2. The Navigator shares it via AirDrop to the Pilot user
  3. The Pilot user's device receives the payload, hands it to the local co-pilot app
  4. The Pilot's co-pilot app gets the coordinates and passes it to the chosen third-party navigation app
  5. The third-party navigation app either starts routing immediately or requires some confirmation to do so (which the Navigator may handle so that the Pilot doesn't get distracted)
  6. Drive there!

An alternative I had originally imagined was to use Bluetooth, but I'm not sure how easy it would be to implement, or whether it would requires the devices to be explicitly paired. Maybe that wouldn't necessary if the Pilot's device could pretend to be a BLE device, but I'm not completely sure. I found rhummelmose/BluetoothKit that may help, but I haven't dug into it yet. I think AirDrop would be good enough, though.

I understand that this is an incredibly niche app, but hey, I'm happy to throw the idea out there in case you or anyone else wants to give it a go. I really wish I had the time to get back into iOS development and play with it! Of course, I'll be more than happy to test anything that anyone may come up with. :-)

[1] https://maps.apple.com/?ll=42.359355,14.162881&q=Dropped%20Pin&_ext=EiYpFnDS8U4tRUAxBoB85oBQLEA5lEX4TXUuRUBB1E4gT7pWLEBQBA%3D%3D&t=k
[2] https://goo.gl/maps/FnmXCc9zQkVQHgSh6
[3] https://maps.google.com?q=42.3591819,14.1627935&hl=it-IT&gl=it&entry=gps&lucs=s2se,a1&shorturl=1
[4] https://omaps.app/wyuQLrJJo3/ and om://wyuQLrJJo3/

@jollino Sorry for ghosting you again...

Anyways, I personally think that your idea could work out but maybe not via BT, as I don't think BT usages in iOS can be that liberal?

I think 'passing' around a small airdrop-able file with the required contents in it, might work though.

Sounds like a fun project to do, if I have the time :)

Mate, that's hardly ghosting, no worries!
I agree on BT probably being limited on iOS, I haven't researched it that much. I did find some sample code about having an iPhone simulate being a BTLE "device", but I'm not sure if that still requires establishing a connection or just sending stuff directly.
I don't think the Airdrop step would be a problem, plus I read somewhere the SDK allows for limiting what to show in the share sheet (so it could only show Airdrop and nothing else). Again I'm not sure if that's still the case, as it was written with iOS 7 in mind!

If you (or anyone else reading this) wants to give it this crazy thing go, tag me and I'll be more than happy to test it. :-)

Hi @jollino,

Just an update: pr #24 should fulfil parts of the original suggestions of this issue!
It will be available (as a preference option (for the coordinates box)) and copy for all, in next app store release (1.4.0)

Nice, I'll be giving it a go as soon as it's released. I really appreciate the update!

@jollino Update should be live on the app store! Need to enable in preferences, do tell me what you think :)

It looks like it's just perfect!
Showing the coordinates right under the cursor is a great touch, as it's way more immediate than having them shown in a fixed location.
Maybe a future version could have a menu item for it, rather than having it in the Preferences window, so that it could be turned on and off via a keyboard shortcut?
It's also great that copying the location works regardless of the setting. A very nice touch. :)
I haven't been doing much driving lately so I only tested it on an old file I had saved, but this gives me a nice excuse to take a break and get out of here. :-D
Thank you for the great update!

Great to know that you love the new update!

Maybe a future version could have a menu item for it, rather than having it in the Preferences window, so that it could be turned on and off via a keyboard shortcut?

Sounds like a great idea!