Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

GPS marker on map #756

Closed
ljbade opened this issue Jan 15, 2015 · 29 comments
Closed

GPS marker on map #756

ljbade opened this issue Jan 15, 2015 · 29 comments
Assignees
Labels
Android Mapbox Maps SDK for Android feature

Comments

@ljbade
Copy link
Contributor

ljbade commented Jan 15, 2015

I want to take whatever @bleege cooks up in https://github.com/mapbox/mapbox-android-sdk/issues/593 and https://github.com/mapbox/mapbox-android-sdk/issues/592 to implement a GPS map marker in the demo app.

@ljbade ljbade added feature Android Mapbox Maps SDK for Android labels Jan 15, 2015
@ljbade
Copy link
Contributor Author

ljbade commented Jan 18, 2015

I changed the GPS button to toggle location updates on or off. The updates are once a second and keep the map centre updated.

I used the https://github.com/mapzen/LOST that @bleege found.

Now I need to figure out how to add a marker to the map with compass direction and accuracy circle.

@incanus I guess this would be a good use of the client-side data stuff you are working on?

@incanus
Copy link
Contributor

incanus commented Jan 20, 2015

Yes, this is exactly what that is for. You can maybe fake it at screen center for tracking for now (i.e. put the marker above the map) but that won't help when you want to pan the map while showing the user.

@ljbade
Copy link
Contributor Author

ljbade commented Jan 20, 2015

Yeah I was thinking about faking it @incanus. To get around the scrolling issue I may calculate screen coord from the zoom level and lat/lon

@incanus
Copy link
Contributor

incanus commented Jan 20, 2015

Yeah, for a single marker, I'll bet that will work fine for now. I'll be watching as that could be useful on iOS as a stopgap too.

@ljbade
Copy link
Contributor Author

ljbade commented Jan 29, 2015

Will need to use these conversions:
#476

@ljbade
Copy link
Contributor Author

ljbade commented Jan 29, 2015

Related iOS ticket: #147

@incanus incanus removed the Android Mapbox Maps SDK for Android label Feb 10, 2015
@incanus incanus added this to the iOS Beta milestone Feb 13, 2015
@bleege bleege added Android Mapbox Maps SDK for Android and removed Android Mapbox Maps SDK for Android labels Feb 16, 2015
@ljbade ljbade modified the milestones: Android Beta, iOS Beta Feb 17, 2015
@incanus incanus modified the milestones: iOS Beta, Android Beta Feb 17, 2015
@incanus
Copy link
Contributor

incanus commented Feb 17, 2015

Related to annotations, I'm curious @ljbade @bleege @1ec5 @kkaefer to hear your thoughts on user tracking settings and how we might push some of that down to the GL core.

For example, on iOS, with our SDK we took the model offered by MapKit, which is to have two separate API:

showsUserLocation

A boolean that either shows the user dot or not.

trackingMode

A three-way option, the latter two options of which require or enable showsUserLocation:

  • .None — Just show (or don't) the user dot.
  • .Follow — Center the map view on the user dot (including during movement) until the mode is changed or the map is panned manually.
  • .FollowWithHeading — Same as above but also keep the map rotated to the direction the user is facing (compass).

Basically, does it make sense to do all of this per-platform (as we have now on Android, for example), or to have the common modes and toggles at the core level and call out to e.g. Core Location on iOS for the location functionality?

@ljbade
Copy link
Contributor Author

ljbade commented Feb 17, 2015

@incanus: how would we feed resources into GL? e.g. different resolution marker bitmaps with different scaling depending on dpi? Android does this for free with my current approach

Is there different behaviour/visuals in respect to how Google vs Apple display GPS location?

Also I would prefer to push the GPS coords from Java to native, and not callback from native to Java to fetch them.

@incanus
Copy link
Contributor

incanus commented Feb 17, 2015

I don't mean to do the marker rendering in the core necessarily, but just the mode state tracking and calling back out to the platform edges for location API and client notifications.

@ljbade
Copy link
Contributor Author

ljbade commented Feb 20, 2015

I have the initial version of the GPS marker (with compass support as backup) in https://github.com/mapbox/mapbox-gl-native/tree/android-conversions

I think I will merge this, and continue more improvements in another branch.

Future improvements:

  • accuracy circle
  • smoothly animate the marker to new positions
  • update marker position during map animations
  • filter compass bearings to reduce shake
  • implement map position tracking and disable when the user pans the map (like Google Maps)
  • add a third state that rotates the map to match the compass and disable when the user rotates the map (like Google Maps)
  • persist GPS on/off state GPS on/off state is not persisted #911

@jfirebaugh
Copy link
Contributor

Per chat, @1ec5 to look at the iOS side of this, porting functionality from the raster iOS SDK.

@incanus
Copy link
Contributor

incanus commented Mar 6, 2015

Per chat, @1ec5 to look at the iOS side of this, porting functionality from the raster iOS SDK.

As a first cut, we'll just do this platform-side. Later, we can push state down into the GL map layer.

@incanus
Copy link
Contributor

incanus commented Mar 7, 2015

A good summary of what's involved is anything mentioning userTracking in RMMapView.m. I don't think we should worry about an MKUserTrackingBarButtonItem equivalent for now.

1ec5 added a commit that referenced this issue Mar 10, 2015
from mapbox/mapbox-ios-sdk

Nothing shows up yet, and accuracy circle annotation and delegate methods are commented out.

Ref #756.
@1ec5
Copy link
Contributor

1ec5 commented Mar 16, 2015

Current status: In the 756-gps-marker branch, I adapted much of the mapbox-ios-sdk implementation but consolidated the drawing code. The delegate methods are still unimplemented, but the user dot is functional now:

user-dot

@ljbade
Copy link
Contributor Author

ljbade commented Mar 17, 2015

@1ec5 so does iOS maps have the soft-lock thing where the map tracks the marker, until you touch it when it disables the lock? I see Google Maps tracks both rotation and pan locking.

I think there needs to be a bit of a deadzone so an accidental touch doesn't unlock the marker.

@1ec5
Copy link
Contributor

1ec5 commented Mar 17, 2015

@ljbade, Apple Maps (and mapbox-ios-sdk) tracks the marker until you manually pan, zoom, or rotate. If you tap the compass (to face north), the map continues to track the user dot but no longer rotates with it. A fudge factor sounds like an interesting idea, probably out of scope for beta 1.

And oh wow, I’m just noticing that we commandeered this Android ticket for iOS work. Oops.

@ljbade ljbade added iOS Mapbox Maps SDK for iOS Android Mapbox Maps SDK for Android labels Mar 18, 2015
@ljbade
Copy link
Contributor Author

ljbade commented Mar 18, 2015

Hmm well once we are done with iOS, might as well just reassign to Android beta milestone rather than closing.

@incanus
Copy link
Contributor

incanus commented Mar 22, 2015

iOS annotations API is in as of eded1d9. Not sure yet how to best reconcile this ticket's branch and that.

@1ec5
Copy link
Contributor

1ec5 commented Mar 24, 2015

Current work, which is fully reconciled with the iOS annotations API, is in the 756-user-dot branch, which depends on #1074.

@jfirebaugh
Copy link
Contributor

Now that we've got a PR for iOS, I'm removing this from the milestone and untagging iOS, but keeping the bug open to track the Android implementation.

@jfirebaugh jfirebaugh modified the milestones: Android Beta, iOS Beta 1 Mar 24, 2015
@jfirebaugh jfirebaugh removed the iOS Mapbox Maps SDK for iOS label Mar 24, 2015
incanus added a commit that referenced this issue Mar 26, 2015
closes #1082, refs #756: user dot on map in iOS
@bleege
Copy link
Contributor

bleege commented Aug 5, 2015

GPS Marker is now in the SDK as of #1940. It's missing the Accuracy Circle for now, but am holding off as we need the location tech first for testing as well as I want to look into redoing the User Location marker artwork to make it more Material Design friendly.

@erf
Copy link
Contributor

erf commented Aug 6, 2015

@incanus i've implemented tracking as you describe, and with using the material design floating action button at the bottom right to toggle the modes, with material design icons from google (https://www.google.com/design/icons/). Would you be interested in me adding this to a branch?

@bleege
Copy link
Contributor

bleege commented Aug 6, 2015

@erf This is great! Thank you for doing this. We'll look to add this as part of #1856 .

@erf
Copy link
Contributor

erf commented Aug 6, 2015

Glad to help!
I'm working on the Android version of Embark (http://letsembark.io), so i'm happy to see this project moving forward.

@ljbade
Copy link
Contributor Author

ljbade commented Aug 14, 2015

@bleege Can we add some sort of optional heading marker arrow to the location dot like you get in Google Maps?

@ljbade
Copy link
Contributor Author

ljbade commented Aug 14, 2015

Also we should try to get some nice compass and location marker artwork that matches Material design.

For reference in Google Maps:
image

Accuracy circle is blue with white ring and drop shadow. it has a small translucent blue ring around it. There is also a separate arrow that can be optionally enabled and shows current compass or GPS heading.

Finally there is a separate lighter translucent blue accuracy circle with a thin darker border. I think this can be drawn in the app so no need for a image here.

The compass is smaller than what we use and partially translucent, and overall 'simpler'. When you tap on it and the map rotates to north you get a brief compass with a 'N`:
image

This then fades out and disappears when map is fully north.

List of images:

  • small white circle with background, grey border and drop shadow for compass background
  • a compass red and white needle with slight shading - this will be rotated as needed in the app
  • a compass red needle with black "N" - I think the N can be rendered in app or use baked image with correct Android font
  • a position marker with blue circle, white border, drop shadow and darker transparent outer ring
  • a small blue arrow surrounded by transparent and aligned to be able to be rotated around the position marker

If we calculate the correct virtual size, then we can work out the dimensions needed for the images at each DPI level.

@bleege Who is best to task with creating us these images?

@bleege
Copy link
Contributor

bleege commented Aug 14, 2015

@ljbade New imagery for UserLocation has already been ticketed internally. :-)

Heading / User Location Following first pass of implementation was graciously provided by @erf . It's on hold for the time being until we can make the processing more efficient. Please recall #2049.

@ljbade
Copy link
Contributor Author

ljbade commented Aug 15, 2015

@bleege Ah I understand! I'm getting mixed up with these different location tickets.

@bleege
Copy link
Contributor

bleege commented Aug 31, 2015

GPS Marker has been long implemented. Will implement Heading / User Location Following in 0.2.0.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android feature
Projects
None yet
Development

No branches or pull requests

6 participants