Reprojecting data between coordinat systems

Hi,
I have the latitude and longitude numbers of the building footprint points created from OSM. the issue is when I try to create a polycurve, polygon or surface patch from this points, dynamo can’t create any of them. The point list seems like this.

image

I need the lat long values to be translated into this type. Because I believe with this type of point list I can create polylines.

image

What are the ways to reproject data between some coordinate systems? By default, OSM in WGS84.

I found this online. Maybe I should download pyrevit and use python packages in dynamo.

Also,I am afraid of the issue in this video stated, it is not recommended to use survey coordinate system. When it is used sometimes it is way too far away from the project coordinate system and the project coordinate system can’t be moved near survey coordinate system.

No need for PyRevit - the same Python code access is available to you with Dynamo’s Python nodes.

The physical location in planar coordinate space for any latitude and longitude dimension doesn’t have a direct correlated value from any latitude and longitude dimension.

Said another way: the linear distance of one degree of latitude at the equator is not equal to the linear distance of one degree of latitude near the poles. The same applies to longitude.

The conversion actually doesn’t have an exact solution, but can be made to work over a small area. This stack overflow post is likely your best bet, but if you are unsure I recommend using another tool (civil 3D, forma) to do the work, and bring the data to Dynamo after converting.

The Elk package may also work for you, as it will read the OSM data and generate the geometry content directly.

2 Likes

How accurate do you need the conversion to be?

import clr

from math import cos, sin

clr.AddReference("RevitServices")
from RevitServices.Persistence import DocumentManager

clr.AddReference("RevitAPI")
from Autodesk.Revit.DB import *

doc = DocumentManager.Instance.CurrentDBDocument

def ll2cc(lat, lon, deg=True):
    
    def rad(d):
        return UnitUtils.Convert(d, UnitTypeId.Degrees, UnitTypeId.Radians)
    
    R = 63710088 # Arithmetic mean radius of Earth in meters
    
    if deg:
        lat, lon = rad(lat), rad(lon)
        
    return XYZ(R * cos(lat) * cos(lon), R * cos(lat) * sin(lon), 0)

loc = doc.SiteLocation # Site Location

lat = loc.Latitude
lon = loc.Longitude

# Translate site location lat, lon to 0, 0
translation = XYZ.Zero.Subtract(ll2cc(lat, lon, False))
transform = Transform.CreateTranslation(translation)

latlons = IN[0] # List of lat lon pairs in degrees

OUT = [transform.OfPoint(ll2cc(*ll)) for ll in latlons]
2 Likes

Thank you Mr Buttery and Mr Small!.
I used your codes and got cc of the points. When all data are constructed from this translation method then it won’t be a problem for the model.

Civil 3d and Forma are probably great tools, I used only civil3d so far with QGIS. I got confused with a lot of format changes, if I have more time I will focus on them too.

Elk package is great but I find it hard to define the scale of the model. Especially if I have much more data that comes from other software. So, I prefer combining them on GIS and extracting values to BIM to get the same scale and coordinates.

2 Likes