Insert KML files

Insert KML files

caseybek95
Advocate Advocate
6,577 Views
8 Replies
Message 1 of 9

Insert KML files

caseybek95
Advocate
Advocate

I have been given a KMZ file that has several KML files in it which contain DAE files that I want to bring into Infraworks.  What is the workflow for this?  I’m trying to get away from having to place all the structures individually and rotate them to accurately to represent them in the real world.  Considering they’re already referenced in Latitude & Longitude there must be a way to convert that to drop right into my Infraworks model.

 

 

Thank you in advance for any help on this.

0 Likes
Accepted solutions (1)
6,578 Views
8 Replies
Replies (8)
Message 2 of 9

elliott.rosenfeld
Autodesk
Autodesk

You can individually import the .DAE files to your model, or to your style palette as 3D models. Otherwise, this is an unsupported script that *may* be able to help you import the KML files. Let me know how this goes:

var filePath = "C:\\\\Users\\username\\Downloads\\doc.kml";
var targetClassName = "BUILDINGS";
var city = app.ActiveModel;

var importKML = function (city, kmlFile, targeClassName) {

    if (!file.FileExists(kmlFile)) {
        printf("Error: KML file not found: " + kmlFile);
        return false;
    }

    var providers = app.GetDataProviders(".kmz");
    var success = true;

    for (p in providers) {

        var configs = providers[p].FileConnect(city, kmlFile);

        for (c in configs) {

            var cfg = configs[c];
            cfg.TargetClassName = targetClassName;
            cfg.SourceCoordSys = "LL84";

            var result = cfg.Import();

            if (result) {
                print("INFO: KML Import success");
            } else {
                print("Error: KML Import Failed");
                success = false;
            }

        }
    }

    return success;
};

importKML(city, filePath, targetClassName);

Principal Specialist, Infrastructure
0 Likes
Message 3 of 9

caseybek95
Advocate
Advocate

Is there away to bring the individual DAE files in so they are oriented and in the correct location?  When I open the KMZ file I was provide I can see them all on the site in Google Earth.  I've brought lots of DAE files into Infraworks but I've only ever interactively placed them in the model.

 

Thank you for your response Elliot I appreciate it!

 

Casey Bekkerus

0 Likes
Message 4 of 9

elliott.rosenfeld
Autodesk
Autodesk

Hi Casey,

I noticed that @John_DeLeeuw posted a script that may solve your problems on another thread. If John's advice isn't what you are looking for, yes you can definitely modify the placement of your .DAE files during import/configuration into InfraWorks. Instead of doing interactive placing, you can specify an arbitrary XY (Meters or Ft.) Source Coordinate System for the data in the "Coordinate System" field within the GeoLocation tab of the Data Source Configuration dialog, then input specific coordinates (Lat/Long or Northing/Easting typically) in the Position field for each .DAE you import. You can also apply X,Y,Z offsets or modify scale and rotation rotation. You can also check out these help topics:


Principal Specialist, Infrastructure
0 Likes
Message 5 of 9

caseybek95
Advocate
Advocate

Any Chance anyone has the Script that Elliott is referring to?   Thank you in advance!

0 Likes
Message 6 of 9

elliott.rosenfeld
Autodesk
Autodesk
Accepted solution

Hi Casey, sorry for not including the link previously, silly oversight. Here's the link to a great article that @John_DeLeeuw wrote about this: https://knowledge.autodesk.com/support/infraworks/learn-explore/caas/simplecontent/content/aiw360-ba...  


Let us know how this works out!


Best,

Elliott


Principal Specialist, Infrastructure
Message 7 of 9

caseybek95
Advocate
Advocate

Thank you!

0 Likes
Message 8 of 9

vincent.bonnefoiS9BT5
Advocate
Advocate

Hi guy, thanks for the link !

By chance, would you havethe 2 scripts normally provided in the post ? The download links are currently broken.

0 Likes
Message 9 of 9

ramesh_sridharan
Autodesk
Autodesk

@vincent.bonnefoiS9BT5  Im not sure what link you are talking about. The script is visible to copy/paste as .js file above here and other help scripts also seem to be valid.

Regards,

Ramesh S
Product Manager - Infrastructure Solutions

Ramesh.Sridharan@autodesk.com



Ramesh Sridharan
Product Manager