Military DictionarySymbolStyle Error

335
8
Jump to solution
08-10-2017 01:08 PM
Highlighted
New Contributor II

I was following your example located here (Display military symbols with a dictionary renderer) in order to display Military Symbols based on the DictionaryRenderer.  I get an error when attempting to Open the Symbol Style as follows:

SymbolStyle ss = await SymbolStyle.OpenAsync(@"D:\Source\MapEngine\ESRI\mil2525d.stylx");
DictionarySymbolStyle dss = ss as DictionarySymbolStyle;

The first line executes properly, but the second line fails ( assigns a null value) when assigning the SymbolStyle to the DictionaryStyle.  I downloaded the styles from here:  (http://solutions.arcgis.com/defense/help/military-symbology-styles/)

Am I missing something here?  I am on 100.1 of the .NET SDK.  

Reply
0 Kudos
1 Solution

Accepted Solutions
Highlighted
Occasional Contributor III

Robert,

Calling as below, I am able to see all the information related to that "mil2525d" symbol properties. I am using your stylx for testing.

var dss = await DictionarySymbolStyle.OpenAsync("mil2525d", @"<folder_path>\mil2525d.stylx");
Console.WriteLine(dss.TextFieldNames[0].ToString());

result: "additionalinformation"

DictionarySymbolStyle.OpenAsync Method 

Hope that helps.

Nagma

View solution in original post

Reply
0 Kudos
8 Replies
Highlighted
Occasional Contributor III

Hi Robert,

I have Runtime Qt 100 installed, the file "mil2525d.stylx" comes with the installation. So I grabbed the file and used your code in .Net application. it works for me. Not sure whether .stylx file is corrupted. Attached is the file for your reference.

Hope that helps.

Nagma

Reply
0 Kudos
Highlighted
New Contributor II

Your file was different, but I got the same result.  I am on 100.1 of the API.  I may try downgrading to 100.0 to see if I get the same results.

Reply
0 Kudos
Highlighted
Occasional Contributor III

Hi Robert,

I downloaded you file from the link and I used 100.1 .Net API and I don't see any issue. Even the size of the two files are different, both of those works without any issue at my side.

Nagma

Reply
0 Kudos
Highlighted
New Contributor II

Interesting.  I am at a loss.  Trying to think of what I may have incorrect that would cause a simple assignment to result in a null.  I would understand of the first one failed

Reply
0 Kudos
Highlighted
New Contributor II

I have the same issue after downgrading, which I expected after your last message.  I will create a small standalone app and see if I can get it to work.  I will let you know what I find.

Reply
0 Kudos
Highlighted
Occasional Contributor III

Hi Robert,

You are right. It is giving null . My code was executed, so I didn't realize it. But when I try to get the properties as below

  Console.WriteLine(dss.TextFieldNames);

I am getting exception. Sorry for that.

Nagma

Highlighted
Occasional Contributor III

Robert,

Calling as below, I am able to see all the information related to that "mil2525d" symbol properties. I am using your stylx for testing.

var dss = await DictionarySymbolStyle.OpenAsync("mil2525d", @"<folder_path>\mil2525d.stylx");
Console.WriteLine(dss.TextFieldNames[0].ToString());

result: "additionalinformation"

DictionarySymbolStyle.OpenAsync Method 

Hope that helps.

Nagma

View solution in original post

Reply
0 Kudos
Highlighted
New Contributor II

That did it.  Thank you so much.  I saw the OpenASynnc On the DictionarySymbolStyle, but ended up following the web site instead.  I have a couple more questions, but I will create a new question within the Forum.  Thanks again for your help.