React Native find north direction - react-native

I'm working on a compass app and need to find current direction to a particular point (I have coordinates), or at least to the north. How can I do that?
Thanks.

For those who faced the same problem:
1) get access to magnetometer and accelerometer of a device. For that you can either write your own react-native <-> java/swift/objC bridge or use one of libraries like these:
github com/pwmckenna/react-native-motion-manager
github com/kprimice/react-native-sensor-manager
2) convert meters' data to compass heading.
Some informations is here:
https://cdn-shop.adafruit.com/datasheets/AN203_Compass_Heading_Using_Magnetometers.pdf
3) If there is a need to find direction to some particular point, first you need to get your own coordinates and then adding that to point's coordinates you can find out azimuth.

It does not support, but you can simply render a polyline annotation from your direction result.

Related

Align GPS position in GPX path

Lets's imagine this. I have tracking devices sending their coordinates. I have a GPX and the map. Now, between point one and two (blue circle from bottom to top) the GPX have no points. The tracker reports his location, but is not tottally align with the line because of weak GPS signal or anything else. I want to align the marker in the GPX line even with no points.
Can i do it? Can you help guys? All comunication and service are in PHP
This is not a trivial problem but you should be able to solve it by utilizing some premade services. This post on GIS StackExchange lists some services that can do this.

Allow only a specific country to be shown in react-native-maps

I am using react-native-maps in my React Native project and I want the map to show only Germany and dhe user should zoom in and out up to a certain level but always withing Germany. I don't want the user to be able to navigate to other countries.
I checked the documentation but I didn't find anything related to my problem. Is there any way to achieve this? Thanks!
As far as I'm aware, you'll really need to 'bodge' this as it's not really true functionality of native maps.
You can limit the maxZoom level, to ensure that they cannot zoom passed a certain point - this will help with zooming. As for scrolling outside of a certain area - you can hitch onto the onDrag event, and check the lat and lon object. If the coordinates are outside a specific boundary, you can take the user back to a specified location - or present a user error? Geo fencing seems like it could be a part of this also.
Apart from theoretical - I'm afraid I've never done this, so cannot show you any implementation.

Getting the source of geolocation coordinates

When using geolocation in react-native, or perhaps any framework that uses geolocation, is it possible to get the source of the coordinates? That is, can I test whether the coordinates came from the GPS satellites, cell tower, or WiFi?
Thanks.
This is currently not possible. See the docs: https://facebook.github.io/react-native/docs/geolocation.html

Titanium Appcelerator - Creating Directions Using a Map?

I'm creating a simple Map application in Titanium Appcelerator, right now focusing only on iOS. I have 2 Annotations specified by the latitude and longitude. I want to draw the directions between the 2 points on the Map.
I see the
mapview.addRoute();
method on the MapView object, but it requires you to input all the points in the route to draw it properly?! That doesn't sound right at all - why would it require me to find all the points when the Google Map can do that already.
Is there a way that I'm missing to simply say "here's point A, here's point B, draw the route between the 2 points on the map".
Drawing routes on the map is nothing more than a vector drawing. The same does the mapsapp on your phone.
You will have to interrogate the maps apis for directions,get the directions (points) and use it in your code to draw the route.
If you don't want to do it yourself there is a free module in the marketplace that can help
https://marketplace.appcelerator.com/apps/2580?87150712
If you want to get your hands dirty, this post might help you:
http://developer.appcelerator.com/question/74221/mobile-map-route-from-google-server

Convert pixel point to Latitude and Longitude

I am trying to create a custom map for iOS. For the time being I am using Openstreetmap images for the custom map app.
Now what I want is to convert the pixel point to Latitude and Longitude value at a particular zoom level. I am finding out the tile(pixel point) in which I clicked. I need to find out the Lat and Long of that particular point. How this can be calculated? Is there any general formula to find the Lat & Long from pixel point.
Thanks in advance
Do you know about route-me (https://github.com/route-me/route-me)? It is an open source iOS map library. I use a fork of this library found at https://github.com/Alpstein/route-me. These libraries provide the projections you are looking for and might even provide other functionalities you would have to implement yourself otherwise.