Report Lat/Long/Elevation for a POI with a simple script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
1) Make sure you have POIs in your model.
Note: Do not select any POIs before running the script. If a POI is selected when you run the script, the User Data field will not report Lat-Long-Elevation until you de-select and then re-select that POI.
2) Click >
>
to open the Scripting Console.
3) Paste this script into the Scripting Area. See: To create and run scripts from the Scripting Console for more information.
function getCoordinate(feature) { var vector = feature.GEOMETRY.Centroid2d; var vector2 = feature.GEOMETRY.BBox3d.Center; if(vector == null) { return; } vector = app.ReprojectPointDbToLL84(vector); if(vector == null) { return; } var longitude = vector.X; var latitude = vector.Y; var elevation = vector2.Z return latitude + ", " + longitude + ", " + elevation; } var db = app.ActiveModelDb; var classID = db.TableIndex("POIS"); var poisTable = db.Table(classID); var poisRow = poisTable.GetWriteRow(); poisTable.StartQuery(); var row = poisTable.Next(); while(row){ poisRow["USER_DATA"]=getCoordinate(row); var featureId=row.ID; poisTable.UpdateFeature(poisRow,featureId); print( "Feature "+featureId+" was updated."); row = poisTable.Next(); } poisTable.EndQuery();
4) Click Start Script. You will be notified about how many POIs were updated. In this example, I have 3 POIs in my model, so 3 features were updated.
5) Select any POI. ( I am selecting the Helicopter POI that I sketched, just for fun).
6) Open the Properties Palette for that POI.
7) Lat-Long-Elevation for the selected POI will appear in the User Data field.
Note: The User Data field will report in Lat-Long-Elevation format, which switches the order of the X-Y values reported in the InfraWorks 360 status bar (bottom-left corner of the application window).
Principal Specialist, Infrastructure