Grasshopper

algorithmic modeling for Rhino

Hey all,

I have a CSV file containing a series of numbers. Two columns of the worksheet are the latitude and longitude coordinates (items 0 and 1) derived from Formhub's geopoint recording function. I'd like to combine this data with the OSM of the entire area, representing the specific La|Lo instances as, say, points.

Any ideas?

I've attached all necessary files.

Many thanks,

/SPM

Views: 1624

Attachments:

Replies are closed for this discussion.

Replies to This Discussion

I think my math is right here, but I didn't spend a lot of time double checking it, so it may be worth looking over it yourself.

The data in your CSV file is mostly in the same area as the OSM, but will move well outside of the OSM bounds for some of the points.

The gist of it is you have to determine the distance that a degree spans in both the latitude (generally consistent) and longitude (varies depending on latitude) directions.  Elk moves the points lat/lon points so that the Rhino origin corresponds with the south/west boundary limits of the OSM bounds, so part of what I added translates the locations of your points based on this as well.

-Tim

Attachments:

Thanks, Tim. I really appreciate you taking a look at this. I understand the gist of what you did, but I'm hoping you could explain the math behind it all. A brief explanation of why you used those particular equations and how you derived them would be great. I'd like to better understand the nitty gritty so I can troubleshoot myself as I go on/next time.

Thanks again.

/SPM

The SRTM file itself is only so accurate.  At its highest resolution (SRTM1) there is one point for about every 30m/100'.  Because of this I wasn't too concerned about how accurate I could get the resulting topography, I just wanted it to be reasonably close so it looked appropriate as context. That sort of drives the rest of it (OSM).

Even though the earth is not truly a sphere, I treat it as one for the purposes of calculating distances in Elk.  So the first step for both the SRTM and OSM translations is to figure out the length of one degree and use that number against the coordinates to determine the position in the XY plane.

Latitude:

The circumference of a circle is 2πr.  The circumference of the earth is about 6371000m so you get about 40 million meters for the circumference.  Further convert that to a distance per degree and you get around 111,194m or 364,812'.  (PI * EarthRadius) / 180 gives you the degree length in meters and multiplying it by Y was just scaling it to feet.  Since circumference is 2πr, another way to write the formula would be (2 * PI * EarthRadius) / 360.

Longitude:

Longitudinal lines converge at the poles so their distance at the equator is the same as latitude (111,194m per degree), but converges to 0 as it gets closer to either pole.  Technically this means that the farther away from the equator you go the points should be slightly closer together.  I'm just getting an average distance for the points, so I get the median latitude degree in order to determine the radius of the earth sphere at that distance.

Then you subtract the lower end of the domains from the CSV's longitude and latitude, and then multiply the resulting decimal number by the calculated lengths for a degree in longitude and latitude and those numbers are combined to be the X and Y coordinates of the points.

Hope this helps.

-Tim

This is fantastic, Tim. Thank you for your time and thorough explanation. I greatly appreciate it.

Cheers,

/SPM

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service