Working with line styles

1141
12
01-09-2024 03:12 AM
IvonaJovanovic
New Contributor

I am trying to recognize line styles from data input and show them properly on the map. What would be the best approach to achieve this?

I've noticed that we can't rely on line style names because some of the data inputs have customized line styles. I've tried relying on dash length line style values but line styles with the same name have different dash lengths.

In the attachments below we can see different line styles in two files which are expected to be the same. The behavior is tested on different tools which proves that these two styles should be equal.

Thank you!

7817e44c-319d-4f28-a303-c1eeb42349ad.png

Linestyle 1.PNG

0 Kudos
12 Replies
MichaelBranscomb
Esri Frequent Contributor

Hi,

Can you provide any more details on the input data process? (line styles from ArcGIS maps, layers, services, packages, etc will automatically be shown properly on the map)

 

Thanks

0 Kudos
IvonaJovanovic
New Contributor

Hi,

My end goal is to show accurate line styles in an ArcGIS runtime for .NET based application. For comparison, I am using ArcMap and ArcGIS Pro.  The source of this data is two .dgn CAD files, both have the same line style when inspected in a CAD application like microstation ( dgn 3) but they render differently when viewed in ArcMap ( see image below) . Note that they render correctly in ArcGIS Pro so the are must be encoded with the line styles correctly or ArcGIS pro can compensate for whatever is missing.

In my application it is rendered as image B, I am using the ODA library, and looking at the line style data I can see that it is different for the same style. 
I can confirm that the measurement units are the same between the two .dgn files.

0 Kudos
PreetiMaske
Esri Contributor

ArcGIS pro supports reading CAD data and perhaps has the capability to read and render it correctly. I am not sure how you are reading and rendering the data in an ArcGIS Maps SDK app, but you could create symbols via MultilayerSymbol APIs and adjust the dash lengths and gaps by applying GeometricEffects on the multilayer polyline symbol. Here is a public sample demonstrating different line style created via MultilayerPolyline symbol. Hope this helps.

 

0 Kudos
IvonaJovanovic
New Contributor

I am using MultilayerPolylineSymbol and DashTemplate to create dash lines. My question is how to populate DashTemplate with proper values. Currently, I am populating DashTemplate with raw dash length data I am getting for each dash. That is working for some CAD files, in some CAD files dash length doesn't match the line style. So my question is am I missing some configuration or is there something more I should pay attention to when populating  DashTemplate? 

0 Kudos
IvonaJovanovic
New Contributor

Examples are attached below. In the first image A, we have an ArcGIS Maps SDK app example with DGN 3 line style not looking as it should be, and in image B we have the same example just opened in ArcGIS Pro (this is what I am trying to achieve)

In the picture B we have a line styles (DGN 3 is labeled)  opened in ArcGIS Maps SDK app and we see that DGN 3 style looks valid.

In the examples folder I have attached .dgn files.

0 Kudos
PreetiMaske
Esri Contributor

When you open the data in Pro, what values do you see in DashEffects for the symbology that you think is correctly rendered? 

0 Kudos
IvonaJovanovic
New Contributor

        <DashTemplate xsi:type="typens:ArrayOfDouble">
            <Double>10</Double>
            <Double>6</Double>
          </DashTemplate>

0 Kudos
PreetiMaske
Esri Contributor

I don't have a good solution for you. But I know ArcGIS Pro treats the values in points and SDK expects DIPS. So if I take values you mentioned above convert points to DIPs, I get something like 

PreetiMaske_0-1705531552742.png

 

```
dashEffect.DashTemplate.Add(10*1.33);
dashEffect.DashTemplate.Add(6*1.33);
strokeLayer.GeometricEffects.Add(dashEffect);

```

If you are reading from data sources that are not yet supported in ArcGIS Maps SDK you will have to add some extra logic in your app to adjust the symbology to match the original data symbology. Note, in some cases it might not be possible at all but for something like dashes you can try tweaking the dash template. Hope this helps.

0 Kudos
IvonaJovanovic
New Contributor

I am reading values from .dgn file which is supported by ArcGIS Maps SDK. I am inspecting CIM values in cim viewer plugin for ArcGIS Pro, and there in DashTemplate I see values 10 and 6. When I inspect raw values from code I see 0.1471 and 0.0735. The raw values I am seeing are in meters. I was wondering what could be the factor that is influencing 0.1471 to become 10 and 0.0753 to become 6?

0 Kudos