Skip to content
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

Export HeadingIndicator from MapLibreRN.ts #692

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Thhomy
Copy link

@Thhomy Thhomy commented Feb 26, 2025

This PR adds an export for HeadingIndicator in MapLibreRN.ts, allowing it to be imported directly from the main package entry point.

@tyrauber
Copy link
Collaborator

Thanks @Thhomy, what is the motivation behind this and the use case?

@Thhomy
Copy link
Author

Thhomy commented Feb 26, 2025

I have a custom UserLocation and I use HeadingIndicator inside

@KiwiKilian
Copy link
Collaborator

KiwiKilian commented Feb 26, 2025

I'm not sure if we want to expose the component in its current state. I would rather like to see it cleaned-up prior to exporting.

You can easily re-create this component with an even adopted style of you own.

@Thhomy
Copy link
Author

Thhomy commented Feb 26, 2025

Ok thanks!

@tyrauber
Copy link
Collaborator

hey @Thhomy, can you explain your use case for a custom UserLocation? This is the second request we got for this. Trying to understand the motivation / requirement.

@Thhomy
Copy link
Author

Thhomy commented Feb 26, 2025

I prefer to manage the location externally to MapLibre (using Expo Location) to get background location updates. For the heading, I use the magnetometer signal filtered with a low-pass filter.

@tyrauber
Copy link
Collaborator

@Thhomy, that's interesting! Why use background location updates? If the app is in the background, the map can't update? Can you expand on this:

For the heading, I use the magnetometer signal filtered with a low-pass filter.
Some code would be great if you could share it.

@Thhomy
Copy link
Author

Thhomy commented Feb 27, 2025

Yes, when the app is in the background, the location is not updated. You need to request background location permissions or create a background task that displays a notification.

Regarding the heading coming from location updates, it represents the direction of travel. However, for pedestrian use, it's often more useful for the heading to represent the phone's orientation. It could be interesting to have an option in Maplibre to switch between these two modes.
However on Android the compass signal is noisy and requires filtering to prevent the heading indicator from shaking.

Sorry my code is a bit messy at the moment but I use watchHeadingAsync from expo-location to get the compass heading.

I also modified the pulse circle around the user location indicator to reflect the location accuracy.

@tyrauber
Copy link
Collaborator

Is your problem just on Android? Have you tried using the { "locationEngine":"google" } configuration option. It is far more accurate than the foss defaull locationManager.

@Thhomy
Copy link
Author

Thhomy commented Mar 2, 2025

I only tried on Android so far. I haven't try { "locationEngine":"google" } because I don't have location accuracy issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants