Convert GPS data Cello-CANiQ - gps

I'm receiving data from a GPS tracker.
Documentation says:
Byte-Aligned Table:
[1] -> System Code, byte 1 – ASCII "M"
[2] -> System Code, byte 2 – ASCII "C"
[3] -> System Code, byte 3 – ASCII "G"
[4] -> System Code, byte 4 – ASCII "P"
...
[45] -> Longitude
[46] -> Longitude
[47] -> Longitude
[48] -> Longitude
[49] -> Latitude
[50] -> Latitude
[51] -> Latitude
[52] -> Latitude
...
I've got the following (hex) data:
...
[45] -> 09
[46] -> 36
[47] -> 4b
[48] -> f8
[49] -> a7
[50] -> 70
[51] -> 7b
[52] -> 00
...
Longitude, Latitude
Longitude and latitude coordinates of current position fix. Both coordinates are sent as
32-bit signed integers, representing the coordinates in 10 -8 radian resolution. Possible
values are -Π to +Π for longitude, or – Π/2 to + Π/2 for latitude. The coordinates refer to
WGS-84 map datum and ellipsoid.
How can I convert this to coordinates around longitude ~ -74, latitude ~4?

I can only base my answer on what you wrote above.
What you have are two 32 bits integers, where "1" represents 10e-8 rad.
So what you can do is multiply by 1e-7 to get radians. To convert to degrees (which is usually used to represent WGS84 coordinates), multiply by 180 / pi.
Something like this:
const oneRadMultiplier = 1e-7 * 180 / pi;
latitudeDeg = 0x09364bf8 * oneRadMultiplier;
longitudeDeg = 0xa7707b00 * oneRadMultiplier;
The numbers that you gave as an example don't really seem to match though. It might be that these integers are stored as little endian. I didn't try, but hopefully the above helps to get you a bit further.

Related

Having the latitude and longitude, plotting in 2d, can I use the 3d formula?

This equations takes in latitude and longitude and returns the y and x coordinates :
y = R * cos(latitude) * sin(longitude);
x = R * cos(latitude) * cos(longitude);
example longitude and latitude :
"lat": 19.0733000,
"lon": 82.9479000,
z coordinate does not exist as its 2d.
Now I get some sort of map part displayed but not so correct in most cases, I googled converting from longitude latitude, and as openStreetMap uses Mercator projection, but using I have a separate question, that how to deal with plotting floating point number values of x and y on screen ?
How the formula can be applied ?
And why using the equation I am using is in appropriate ?
No, you cannot use the above formula to plot in a 2d plane. Trying (0N, 0E) gives coordinates (
R, 0) and (0N, 90E) gives coordinates (0, R).
This gis link discusses the Mercator projection: https://gis.stackexchange.com/questions/20686/mercator-projection-problem-with-latitude-formula

CoreLocation - what do the latitude and longitude numbers actually represent

I have :
+37.785834 (lat)
-122.406417 (long)
The LAT positive means North of the equator
The LONG negative means to the West of 0
So far so good.
But what does the number represent exactly ? For example suppose I added 0.000001 to the LAT what would this actually represent ? That I have moved in some Northerly direction by 1 metre, for example or....
If I understand what these numbers actually represent then I can use them intelligently.
Longitude and latitude are measured in degrees. The latitude ranges from -90° (south pole) to +90° (north pole). The longitude ranges from -180° to +180°.

Compute the length difference out of a longitude latitude double

Given two gps coordinates the length difference can be calculated by using the haversine formula. But what about the other way around:
Compute the length difference in meter for a given Lat/Long double
Compute the Lat/Long double for a given length in meters
I know this is not exactly possible since it differs from the point on the earth you are, but is it possible to approximate this or something similiar? This does not have to be very precise.
If your displacements aren't too great (less than a few KM), use the quick and dirty estimate that 111,111 meters in the y direction is 1 degree (of latitude) and 111,111 * cos(latitude) meters in the x direction is 1 degree (of longitude).
Alternatively:
//Position, decimal degrees
lat = 51.0
lon = 0.0
//Earth’s radius, sphere
R=6378137
//offsets in meters
distanceNorth = 100
distanceEast = 100
//Coordinate offsets in radians
dLat = distanceNorth/R
dLon = distanceEast/(R*Cos(Pi*lat/180))
//OffsetPosition, decimal degrees
latO = lat + dLat * 180/Pi
lonO = lon + dLon * 180/Pi
This should return:
latO = 51,00089832
lonO = 0,001427437

How can I create SQL Server Geography polygons that are of a specific size?

I want to create a group of polygons for a city that are 80km x 80km. Given a starting Lat and Long, my thought is I can add 80km to that point so that I get 4 points to create the polygon.
(x,y) -> (x+80km, y) -> (x+80km, y+80km) -> (x, y+80km) -> (x,y)
Where I'm having difficulty is finding a way to calculate the point +80km. I've found the SQL Server Spatial Tools and there is a function
SqlGeography LocateAlongGeog(SqlGeography g, double distance)
But so far I haven't been able to figure out how to use it. I will continue to play with this but if there are any other approaches I can take, or if anyone knows how to properly use this function, I'd be grateful.
Longitude is a "great circle" measure, i.e. if you draw a circle representing a particular longitude round the Earth, it's always a circle whose centre is the centre of the Earth - so to circumnavigate the Earth at a constant longitude, you always travel the same distance:
2 * PI * 6378 /* 6378 is the radius of the Earth in km */
So, moving North (i.e travelling along the same longitude) 80 km will increase your latitude by:
360 * 80 / (2 * PI * 6378)
Latitude is trickier cos the distance travelled when you circumnavigate the Earth at the same latitude changes depending on the latitude at which you're travelling: however, the formula is simple and I looked it up at: http://www.newton.dep.anl.gov/askasci/env99/env086.htm
2 * PI * 6378 * COS(LAT) /* where LAT is your Latitude */
So, if you are at latitude LAT, and move 80km East, you will increase your longitude by:
360 * 80 / (2 * PI * 6378 * COS(LAT))
Couple of things to note:
a) 6378 is only accurate to the nearest km
b) The East/West between your two Northerly points will not be precisely 80km - not significantly different for Latitudes between about 80 degrees North and 80 degrees South - as long as you're not looking for high-precision pinpoint accuracy (which I'm guessing with base measurements of 80 km you're not) it'll do just nicely (and point nicelt at Bing or Google, say)
c) SQL calculates trigonometry functions using radians not degrees - so in SQL your cosine will need to be:
COS(PI * LAT / 180)
HTH and makes some sort of sense

How to find latitude and longitude

I have latitude and longitude of a point.I have to find out the latitude and longitude of another point from a relative distance from the known point.For example point A has some location with latitude and longitude.What is the latitude and longitude after moving 1000m south and 500m west from point A.Is there any direct equation to find this? Thanks in advance
Note the accepted answer is basically the flat earth projection equations:
x = δlon * EarthRadius * cos( lat )
y = δlat * EarthRadius
For better accuracy over larger distances, you should compute the final lat/lon from a typical bearing/range calculation. See the section Destination point given distance and bearing from start point at this website: http://www.movable-type.co.uk/scripts/latlong.html
Instead of looking up an equation you can calculate as follows. Let R be the radius of the Earth. Let a be the current latitude and b be the current longitude. Then if you move δx metres east (negative for west) then δy metres south, calculating the new longitude can be done as follows.
Intersecting a horizontal plane with the Earth at the current latitude will give you a circle of radius R*cos(a). So to convert δx to the change in longitude, you get something like
δlong = δx * 2π / (2π * R * cos(a)) = δx / (R * cos (a))
The change in latitude is easier, since it doesn't depend on the current position. You're always moving around a great circle through the two poles. Then δlat = δy / R. (Of course you need to mod out by 2 π at some point).