Scripts/Airports.ps1
import-module pwps_dab -Force New-PWLogin -DatasourceName brumd09515rem:pwv8i #variables $foldername = "Maps\GeospatialXXX\Airports01" $spreadsheet = "c:\temp\Airports01.xlsx" $environmentname = "Airports01" $tablename = "t_Airports01" #build my new environment New-PWEnvironment -EnvironmentName $environmentname -TableName $tablename -ColumnName LocationName -Interface $environmentname Add-PWEnvironmentColumn -EnvironmentName $environmentname -ColumnName WellKnownText -ColumnType text -ColumnWidth 512 -Interface $environmentname Add-PWEnvironmentColumn -EnvironmentName $environmentname -ColumnName Address -ColumnType text -ColumnWidth 512 -Interface $environmentname Undo-PWLogin #redo login to get environment properly set New-PWLogin -DatasourceName brumd09515rem:pwv8i #create folder path, fill with abstract documents, set an attribute New-PWFolder -FolderPath $foldername -StorageArea Storage -Environment $environmentname | New-PWDocumentAbstract -DocumentName APT -Count 20 | Update-PWDocumentAttributes -Attributes @{LocationName = "Location not set"} #generate spreadsheet so we can update the attributes easily Save-PWDocumentReport -ProjectWiseFolder $foldername -OutputFileName $spreadsheet -Fast #update using values from here #https://www.faa.gov/airports/planning_capacity/passenger_allcargo_stats/addresses/media/public-use-airports-2015.xlsx #reimport to update the attributes Import-PWDocumentsBySpreadsheet -InputFile $spreadsheet -DefaultStorage Storage #Get the documents into an array by search with their attributes $documents = Get-PWDocumentsBySearch -FolderPath $foldername -GetAttributes $hash = @{} foreach ($d in $documents) { $hash = $d.CustomAttributes Write-Output($hash.ADDRESS) #lookup the address and assign the location Set-PWDocumentGeoSpatialLocation $d -Address $hash.ADDRESS -SizeOfBoxInDegrees .02 #get the WKT representation $wkt = Get-PWDocumentGeoSpatialLocation $d Write-Output($wkt) #update the attribute with that value so we can see it Update-PWDocumentAttributes $d -Attributes @{WELLKNOWNTEXT = $wkt } #rename the document with the location name $d.Name = $hash.LocationName } #apply the name changes Update-PWDocumentProperties $documents $index = 5 Write-Output($documents[$index].CustomAttributes.LocationName) #write data file Get-PWDocumentGeoSpatialLocation $documents[$index] -GetGeoJSON > 'C:\inetpub\wwwroot\cesium\Apps\a.geojson' #navigate to local webpage Start-Process -FilePath Chrome -ArgumentList http://localhost/cesium/Apps/PWGEO.html ############################################################################ |