Grasshopper

algorithmic modeling for Rhino

Tricky1 - Latitude & longitudinal co-ordinate points into points & lines

Hello There,

i have few few Latitude & Longitude coordinates of a region.

i want to plot all the points sequentially, hence direction vector is very important, and create a line between subsequent points. Finally to create a grid pattern.

Example co-ordinate points as below

Point 1: Longitude = 172.67848 & Latitude = -43.58213

Point 2: Longitude = 172.35249 & Latitude = -43.63093

Can any1 help please?

Kind regards,

AB

Views: 2037

Replies to This Discussion

Are these points defined in a file, where each line looks like your example?

Morning David,

yes i have longitudes & latitudes in file and i think i have resolved it by assuming earth is a sphere and converting geographical coordinates into Cartesian coordinates by using simple trigonometric formula for a sphere with R = 6370.  I kind of get the result but the distance between the 2 points in GH vary slightly when compared with calculated distance.

Regards,

AB

Hi Agneesh,

The method I/we use is to calculate how much one degree is in meters at these locations and plot them with reference to a local Origin.

Formula for 1 degree of Latitude:

Format("{0:0.00}",111132.09-566.05*cos(rad(2*Phi))+1.20*cos(rad(4*Phi)))

For 1 degree of Longitude:

Format("{0:0.00}",111415.13*cos(rad(PhiM))+94.55*cos(rad(3*PhiM))+0.12*Cos(rad(5*PhiM)))

Where Phi and PhiM are actually the same and is the Latitude of your Local Origin. For instance you might pick 45º 30.0'S 172º 0.0'E as your local origin. Therefore you would plug the Formulae above into the F input of an Evaluate component and -45.5 into a Phi Input to get how many meters are in one degree of Latitude at this location. From there you just subtract the Origin and multiply the remainder with the 1º answer to get the distance from your local origin in Y and then the same for X using the other formula

 

The formulae come from Bowditch's American Practical Navigator which hasn't changed much since it was first published in 1799

For reference:

Explanation of navigational Tables

Scroll down to Cartographic Tables: Table 7 - Length of Degree of Latitude and Longitude.

My friend Danny how r u?

Thanks for your solution. I always learn something new from u. However, i should have told you, that i have list of lat & long and i want to plot them in Cartesian coordinates (x & y only as it is a small region in NZ, hence Z coordinate could be ignored). As mentioned above i have used simple trigonometry to convert them into XYZ.

Regards,

AB

That's what that method is for. Changing coordinates on a sphere (the earth) to a local Cartesian system in meters.

You have to remember that a degree of longitude at high latitudes is much smaller than a degree of longitude at the equator.

My methodology is to:

1) Read in File

2) Convert the Latitude(longitude to a Decimal format. e.g. 42º 30.0'S would become -42.5

3) Set the origin (can be an arbitrary co-ordinate close to/in the middle of your area).

4) this value for Lat would be Phi

5) plug the decimal lat co-ordinates of your file into the Lat 1º expression

6) subtract the origin from the lat co-ordinate in decimal degrees and multiple the answer by the 1º answer.

This gives you meters in the Y direction from your chosen origin

Repeat for Longitude but make sure you use the Latitude of your origin as PhiM, this giving you X from your origin.

 

If you need to you can PM me.

RSS

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service