Select to view content in your preferred language

How do I update Milsoft (Windmil) with Assembly Names Data without doing it manually?

2840
3
Jump to solution
06-08-2017 11:45 AM
AmandaOpp
Regular Contributor

I work with field data collectors using ESRI’s Collector for ArcGIS.  The system is published to ArcGIS Online from ArcMap.  Data is collected on Pole Assemblies as well as height, class and species.  I am able to update the height, class and species fairly effortlessly in Windmil with this data that they have collected but we are lacking a quick way to update the collected assemblies. 

 

In the past, I would go one by one through the data and update the assemblies one at a time.  As you can imagine, this is a time consuming process and tedious.  I am reaching out to see if there is way to quickly add this data (All preformatted) back to Windmil? 

 

In the first attachment, we have all of our data and the second attachment is where we want to convert all of our data.  Any ideas or workarounds are greatly appreciated.

windmilmap‌

windmil‌

milsoft‌

0 Kudos
1 Solution

Accepted Solutions
TylerGrosshuesch1
Deactivated User

Amanda and I worked together on this and came up with a solution. The field user is editing the "Assemblies Count" string and the result is in the attached sample.csv file where one line represents each pole or other map point. There can be many assemblies listed on each line. The script parses that string and converts it to Milsoft .asm format (sampleAssemblies.asm) where each line lists one assembly. That file can be imported in WindMil or WindMilMap, updating the assemblies all at once. The field user has to be very careful not to alter the format of the Assemblies Count string.

#-------------------------------------------------------------------------------
# Name:        sampleCsvToAsm.py
# Purpose:     prototype for Amanda at Flathead to read assemblies as collected during
#               field survey to Milsoft ASCII .asm format
# Author:      Tyler Grosshuesch
#               tgrosshuesch@acecwi.com
#               tdgrosshuesch@gmail.com
# Created:     2017-06-23
#-------------------------------------------------------------------------------

#Change these two paths as necessary
input = r'C:\TEMP\sample.csv'
output = r'C:\TEMP\sampleAssemblies.asm'

asmHeader = 'Map Point Name,Assembly Name,Quantity'

with open(input, 'rb') as inFile:
    with open(output, 'wb') as outFile:
        toWrite = asmHeader #start building the output string
        content = inFile.readlines()[1:] #read the file and skip first line, https://stackoverflow.com/a/4796812
        for line in content:
            firstCommaAt = line.index(',')
            mapPointID, assemblies = line[:firstCommaAt], line[firstCommaAt+1:].strip() #split it into pieces with the map point ID and the list of assemblies and quantities
            assembliesWithQty = filter(None, assemblies.split(',')) #filter removes the nulls, split breaks them into a list of individual (qty)assembly pairs
            for aQ in assembliesWithQty:
                qty, assembly = aQ.replace('(', '').split(')') #get rid of the '(' character and split the qty and assembly into pieces on the ')' character
                print(mapPointID + ',' + assembly + ',' + qty) #for testing
                toWrite = toWrite + '\n' + mapPointID + ',' + assembly + ',' + qty #add each assembly to the output string on a new line
        outFile.writelines(toWrite) #write the output string all at once to the output file) #write the output string all at once to the output file‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

3 Replies
TylerGrosshuesch1
Deactivated User

Hi Amanda,

If you're recording assemblies in Collector and trying to get them into WindMil, the ASCII import is the best way. The first picture that shows the format, it's a simple csv file. I typically do the import in WindMil rather than WindMilMap because it's faster. On the WM menu bar, File > Import, and work through the many options. In WMM, start an edit session, then on the menu bar, WindMilMap > Import Data and you'll get the same options you'd see in WM. You should be able to find the Milsoft WindMil ASCII format doc here, if you have the default install path: "C:\Milsoft\WindMilMap\Documents\file_layouts.pdf"

If you already see the assemblies in the Map Point Editor (your first picture) but not when you look at the same feature in its attribute table (your second picture), maybe your WMM config is out of whack. I see the same thing in both places and don't have to do anything to make that happen - it's built in to WMM (my second picture). You'll want to contact Milsoft support if that's the problem. They'd be able to go through the ASCII import process with you too.

Get in touch with me directly if you have any questions, I'd be happy to help another WindMilMap user!

Tyler,  Adams-Columbia Electric Co-op

Milsoft ASCII .asm file structure

0 Kudos
AmandaOpp
Regular Contributor

tyleracec, I would really like to get a little more help from you.  I can kind of fumble my way through your directions and I get an error on everything.  Would you email me your contact information.  a.opp@flathead.coop

Thank you!

0 Kudos
TylerGrosshuesch1
Deactivated User

Amanda and I worked together on this and came up with a solution. The field user is editing the "Assemblies Count" string and the result is in the attached sample.csv file where one line represents each pole or other map point. There can be many assemblies listed on each line. The script parses that string and converts it to Milsoft .asm format (sampleAssemblies.asm) where each line lists one assembly. That file can be imported in WindMil or WindMilMap, updating the assemblies all at once. The field user has to be very careful not to alter the format of the Assemblies Count string.

#-------------------------------------------------------------------------------
# Name:        sampleCsvToAsm.py
# Purpose:     prototype for Amanda at Flathead to read assemblies as collected during
#               field survey to Milsoft ASCII .asm format
# Author:      Tyler Grosshuesch
#               tgrosshuesch@acecwi.com
#               tdgrosshuesch@gmail.com
# Created:     2017-06-23
#-------------------------------------------------------------------------------

#Change these two paths as necessary
input = r'C:\TEMP\sample.csv'
output = r'C:\TEMP\sampleAssemblies.asm'

asmHeader = 'Map Point Name,Assembly Name,Quantity'

with open(input, 'rb') as inFile:
    with open(output, 'wb') as outFile:
        toWrite = asmHeader #start building the output string
        content = inFile.readlines()[1:] #read the file and skip first line, https://stackoverflow.com/a/4796812
        for line in content:
            firstCommaAt = line.index(',')
            mapPointID, assemblies = line[:firstCommaAt], line[firstCommaAt+1:].strip() #split it into pieces with the map point ID and the list of assemblies and quantities
            assembliesWithQty = filter(None, assemblies.split(',')) #filter removes the nulls, split breaks them into a list of individual (qty)assembly pairs
            for aQ in assembliesWithQty:
                qty, assembly = aQ.replace('(', '').split(')') #get rid of the '(' character and split the qty and assembly into pieces on the ')' character
                print(mapPointID + ',' + assembly + ',' + qty) #for testing
                toWrite = toWrite + '\n' + mapPointID + ',' + assembly + ',' + qty #add each assembly to the output string on a new line
        outFile.writelines(toWrite) #write the output string all at once to the output file) #write the output string all at once to the output file‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍