Adding Fields When Creating an LRS Network

721
2
09-06-2018 12:36 PM
anayoung
New Contributor III

Hello,

This might sound like a rather silly question but I'm new to building LRS networks. And this is driving me nuts!

When you create an LRS network the process creates a feature class for you with only three fields. You can change the name of the fields but cannot add any fields until your done creating the network feature. My issue is that the SHAPE_Length field ends up being in the middle of the table rather than at the end once you add the new fields. I want the SHAPE_Length field to be at the end like it normally is. How do I get it there? This is not your normal type of feature class. See step 9 in the below link:

Creating an LRS Network—Roads and Highways Desktop | ArcGIS Desktop 

In my quandry I imported a feature class with all off the features and fields I wanted into the geodatabase with the LRS ( this feature was used to load the routes), renamed the the feature class that the process described above created, and named my imported the name of the LRS network feature class. That seems to work but it still scares me...is this how it's done?

Thanks,

Ana

0 Kudos
2 Replies
CliveReece
Esri Contributor

Hello Ana,

I understand your trepidation about swapping out one of the ALRS feature classes with a copy that you modeled independently.  Be reassured, that is a valid method we commonly use in a professional services consulting engagements.  But  ... you do need to be very careful about matching the coordinate reference system and XY and M tolerance and resolution settings with those that match the ALRS.  If you don't, you'll break the data integrity model of the ALRS.  And (with near 100% confidence) the default settings when you create a new feature class are *not* going to match the XY/M tolerance and resolution settings for your ALRS. 

I'll mention three tools that we use for re-ordering fields in a feature class:  

TLDR ... skip ahead to #3. Notepad ++

  1. Enterprise Architect (EA)(Sparx Systems) - We use EA when we are designing and documenting a new ALRS for a customer and we need the ability to iterate quickly on changes to route network and event design decisions from the customer.  The great thing about this tool is it knows about the Esri geodatabase.  That allows us to model all data objects in UML and then export directly to a geodatabase XML workspace.  If you need to tweak the data schema (including field order), then it is a simple matter of altering the UML design and re-exporting the geodatabase XML.  The down side to this tool is it requires a lot of expert knowledge on geodatabase objects and the Roads and Highways minimum schema.  There is also a huge learning curve before you become proficient with the tool.  
  2. X-Ray for ArcCatalog - This add-on for ArcCatalog provides a geoprocessing tool to re-order fields in a geodatabase table or feature class.  This will be the easiest tool for ad-hoc reordering any field EXCEPT it doesn't work on Shape or Shape_Length fields (sorry).  So X-Ray won't help you for your goal of moving the SHAPE_Length field to the end of the field list.
  3. Notepad++ with the XML Tools plugin - This will allow you to move the SHAPE_Length field to the end of the field list.  I use this method frequently for ad hoc feature class schema changes that include field re-ordering: 
    • Export your current feature class to an XML Workspace document (schema only, no metadata)
    • Open the XML in Notepad++
    • Using the XML Tools plugin, select "Pretty print (XML only - with line breaks)"
    • Skip down to the xpath for /esri:Workspace/WorkspaceDefinition/DatasetDefinitions/DataElement/Fields/FieldArray
    • Look for the XML section for SHAPE_Length:  
      • <Field xsi:type='esri:Field'>
        <Name>SHAPE_Length</Name>
        <Type>esriFieldTypeDouble</Type>
        <IsNullable>true</IsNullable>
        <Length>8</Length>
        <Precision>0</Precision>
        <Scale>0</Scale>
        <Required>true</Required>
        <Editable>false</Editable>
        <ModelName>SHAPE_Length</ModelName>
        </Field>
    • Copy(cut) this XML block and move(paste) at the place in the <FieldArray> block where you want the Shape_Length field to show up in your feature class (at the end). 
    • Save the XML file
    • Back in ArcGIS desktop, right-click your geodatabase and import the XML workspace
    • Verify the field order is how you want it

Note:  the Notepad++ method may take you a few trials to get it right, especially since you have to be careful not to mess up the XML structure, but it should accomplish what you want.  

GOOD LUCK!  and let us know if this works for you

0 Kudos
anayoung
New Contributor III

Hi Clive,

Great information! I'm glad you understood my problem and took the time to respond to me.

If possible, I will try the third method with Notepad++ today and get back to you with the result. It will be good to have an expedient way to reorder schema moving forward. 

As far as the XY/M tolerance and resolution settings, I made sure that the independent feature class had matching settings - so, that worked out fine. It freaked me out but I do know that when you perform a "hot swap" it's important to name the feature the exact name as the event so that it's recognized by the network. So, I figured it probably worked the same fro the network feature. But I wasn't sure since there's so many things that can go wrong with an ALRS. 

Thanks again! With luck, you'll be hearing from me soon.

Sincerely,

Ana

0 Kudos