Jump to content
Software FX Community

out-map -labellinkfile and -createlabellinkfile


Recommended Posts

I've created a 'labellinkfile' as per the quick start guide:

out-map -mapsource World\WorldCountries –createlabellinkfile countries0.xml

I've then looped through the file to make some modifications:

gc countries0.xml|foreach {  if($_ -match "<DataText>U.S.A.</DataText>"){   write-output "<DataText>USA</DataText>"  }  elseif($_ -match "<DisplayText>U.S.A.</DisplayText>"){   write-output "<DisplayText>USA</DisplayText>"  }  elseif($_ -match "<DataText>U. K.</DataText>"){   write-output "<DataText>United Kingdom</DataText>"  }  elseif($_ -match "<DisplayText>U. K.</DisplayText>"){   write-output "<DisplayText>United Kingdom</DisplayText>"  }  elseif($_ -match "<DataText>Netherlands</DataText>"){   write-output "<DataText>The Netherlands</DataText>"  }  elseif($_ -match "<DisplayText>Netherlands</DisplayText>"){   write-output "<DisplayText>The Netherlands</DisplayText>"  }  else{   write-output $_  }}|out-file -encoding ascii countries.xml

I'm assuming I need to change the DataText and DisplayText XML sections to match my data input and modify what the display text is for each country.

Now, that doesn't seem to be working properly.

Is this the proper way to call the XML file when I'm creating my map:

out-map -labellinkfile countries.xml [some other stuff]


Link to comment
Share on other sites

I have detected the following issue with createlabellinkfile: we create the xml file based on the SVG objects' structure, but one of the object names (Sao Tome & Principe) causes an invalid xml. We will review all of our maps to avoid the use of non xml-standard characters, but in the meantime there is a workaround. Add another entry to the script where you make modifications to the xml file, including a fix for Sao Tome & Principe as follows:

elseif($_ -match "<DataText>Sao Tome & Principe</DataText>"){   write-output "<DataText>Sao Tome and Principe</DataText>"  }  elseif($_ -match "<DisplayText>Sao Tome & Principe</DisplayText>"){   write-output "<DisplayText>Sao Tome and Principe</DisplayText>"  }  elseif($_ -match "<SvgText>Sao Tome & Principe</SvgText>"){   write-output "<SvgText>Sao Tome and Principe</SvgText>"  }Now that you have a valid XML, all you have to do is populate the map with a datasource containing the data in your desired format. For example, I created a basic Data.csv file with the following data:

Country,PopulationUSA,100United Kingdom,120The Netherlands,130France,140Argentina,80

Then I get the data from the csv and pass it to out-map as follows:

import-csv data.csv | out-map -label Country -value Population -MapSource World\WorldCountries -LabelLinkFile countries.xml

Note that I need to specify the column used as label and the column used as value because import-csv returns all the data as string. If you use a different datasource in which the values are returned as numbers (e.g. invoke-sql), then you wouldn't need that.


Link to comment
Share on other sites

I wanted to let you know that we have fixed the bug caused by the & sign in the SVG's, without the need to modify the SVG source maps. The fix has not been made public yet, though. We don't know exactly when the public build will contain this fix, but we hope we can upload it within the next couple of weeks.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...