Shared Samples

GeoMedia, a comprehensive and dynamic GIS, extracts compelling intelligence from geospatial data and integrates it to present actionable information. Please note a HGDN subscription is required to download code samples
Showing results for 
Search instead for 
Do you mean 

Generate Line Markers

by Technical Evangelist on ‎01-04-2017 10:05 AM (880 Views)

Introduction

Often there is a request to generate points evenly distributed along a linear feature. There exist several solutions of this task, however, none of them seems to be straightforward. The possible solutions may involve customization or other product to be installed and licensed. They can be summarized into the following three groups:

  1. Create custom command which employs CustomFieldPipe to generate the points
  2. Create an additional table to be served as Events table and use LRS to generate the points
  3. Use Transportation Manager to generate the Events table and use LRS

We will use LRS in this sample, however, the Events table will be generated dynamically using custom functional attribute.

 

Create the line markers

So first of all, install the custom function package using the install and download instructions bellow. After that, the function named GENEVENTS will appear in the Misc category of functional attributes.

 

Then open a gws with the linear feature class you would like to generate markers on:

LRS01.png

 

Create two functional attributes on this feature class. First named BegMeas with constant value 0.0:

LRS02.png

 

And the second one called EndMeas with value LENGTH(Input.Geometry):

LRS03.png

 

Save the query as "Bounds of FeatureClass1" and let it to be shown neither in Map window nor in Data window:

LRS04.png

 

Next create another functional attribute based on the last query and use the new GENEVENTS functional attribute. The function has the following arguments:

offset - the distance from the beginning of the line

distance - the distance between the stops

count - the number of stops to be generated

See the next picture and choose values appropriate for your data:

LRS05.png

 

Save the query as "Stops of FeatureClass1" and again don't show it anywhere.

LRS06.png

 

Finally, let's use LRS to create the markers. Run "Dynamic Segmentation" command from the Analysis ribbon tab. Select the "Bounds of FeatureClass1" as the "LRS Features", "LRS Measure" as "LRS Model" and "Stops of FeatureClass1" as "Event Feature, LRM Based".

LRS07.png

 

Click "Properties" of "LRS Model" and set "LRS Primary Key" to "id" (or primary key of your original feature class), "Begin measure" to "BegMeas" and "End measure" to "EndMeas":

LRS08.png

 

Click "Properties" of "Event feature" and set "Event Type" to "Point", "Event Reference Type" to "Measure", "Primary key" to "id" (the same as for LRS Model) and "Event Measure" to "Stops":

LRS09.png

 

The "Dynamic Segmentation" dialog should be filled by defaults as soon as you click OK on the previous dialog. So click OK on Dynamic Segmentation and examine the result in your map:

LRS10.png

 

Installation instructions

You should either compile the source code while running Visual Studio (2010 or newer) "As Administrator", or to register the assembly dll using regasm with /codebase switch. Then you need to manually create some registry entry. The code contains a file RegisterProcedure.txt with details.

 

Download links

C# version for GeoMedia 2014 or newer: HGDN / Mod_CommCustomFunctions_2016CS or git command git fetch && git checkout Mod_CommCustomFunctions_2016CS

 

Knowledge level

Advanced

 

Note: the sample custom functions package contains more sample functions.

Overview
Contributors