-1

I have the relative position for some point P2 on the Map as x y z coordinates. This position is relative to some position P1 define by its longitude and latitude and heading. how can I compute the longitude and latitude for P2?

For example: P2: x = 24, y = 26, z = 30 P1: lat/lng: 53.090734, 10.435428 with heading 110°.

P2 is relative to P1. How to compute P2 lat/lng?

This is what I tried but it doesn't work.

latP2 = latP1 - (Math.sin(Math.toRadians(heading)) * X + Math.cos(Math.toRadians(heading)) * Y) * (1.0 / 111000.0);
    lonP2 = longP1 + (Math.cos(Math.toRadians(heading)) * X + Math.sin(Math.toRadians(heading)) * Y) * (1.0 / 71500.0); 

I think I don't need to use z value in my calculation:

Peter O.
  • 32,158
  • 14
  • 82
  • 96
simplo
  • 91
  • 1
  • 1
  • 10
  • 1
    Do you know where these coordinates came from, and whether it's a geographic coordinate system or projected? See http://gis.stackexchange.com/q/664 for explanation of these terms. In short, geography coordinate system assumes earth is a sphere or ellipsoid, and a projected coordinate system is used to transform sphere or ellipsoid coordinates to coordinates on a flat plane.. For example, GPS data is by default in geographic coordinate system WGS1984, which is usually what the terms lat/long refer to. You'll also need to know the units of offset you are using to find P2. – Sean Barbeau Jun 29 '15 at 00:00
  • What are the units of x, y and z? Are they meters? Miles? Nautical Miles? Some other unit? How is the x,y,z coordinate system oriented with respect to the Earth? Why don't you think you need to use z? What does the heading at P1 have to do with P2? – geocodezip Jun 29 '15 at 01:21
  • thanks for your answer. there is geographic coordinate system the are comming from GPS module. The Units are all in meters. The P2 refered to some image that are capture from point P1 and i want to know exactly the location (lat/lng) of P2. the divice that captude this image (P2) only give me the relative P2 coordinates as x y z – simplo Jun 29 '15 at 09:34

1 Answers1

0

From the updaten quetsion and the discussion, you have got the coordinate in lat,lon and the direction of sight, measured in degrees relative to North. Addionally you have an offset x,y given in meters. Now you want the new position, e.g where increasing y is releated to line of sight.

Such a calculation always follow the same principle.

  1. Convert your lat/long cooridnate(s) to a local cartesian coordinate system, measured in meters. (Now you have position x,y coordinates as learned in school)

  2. Do the (vektor) math as you learned in school, which will give you a new point.

  3. convert the new point back using the inverse transformation.

For step 1, and 3 see Find intersection of two Locations and the discussion in chat

Community
  • 1
  • 1
AlexWien
  • 28,470
  • 6
  • 53
  • 83
  • x,y,z doesn't come from gps. This position are coming from a Camera software that capture a Pic. that mean the captured pic is in x,y,z (in meters) away. somethink like that. – simplo Jul 04 '15 at 08:11
  • So you have a Gps Position given by latitue, longitude (and probably altitude) and a given offset in meters, and want to calculate a new coordinate. Then ther ist the open problem: is the x,y offset related to North, or to the direction of sight of the first picture? – AlexWien Jul 06 '15 at 16:11
  • yes ! Gps Position are : latitue, longitude and altitude. And the x,y offset related to the direction of sight of the picture. – simplo Jul 07 '15 at 17:14
  • Then you need the direction of sight given in degrees (0-360), where North = 0 degrees, east = 90; Otherwise it will not work. – AlexWien Jul 07 '15 at 18:57
  • What does mean x= 1, y= 5?; 5meters in line of sight then 1 meter right? – AlexWien Jul 07 '15 at 19:19
  • exactly ! The car that take the picture is driving in one direction and i also have the heading of that car. ist look like some car is driving and take a picture of one TrafficSign on this route. The camera that take the picture give the position of that picture like : x = 1 m (right) , y = 5 m .(in line of sign) . The Proble is now to compute the really lng/lat for that TrafficSign – simplo Jul 08 '15 at 21:08