I have an Esri Silverlight/WPF UI with a mapcontrol and a slider. In the mapcontrol is a graphics layer with a single polyline on it, created using coordinates from a layer in a mapservice. The shapefield of the featureclass used by the mapservice has PolylineM's.
I would like to find a way to move a point marker graphic along the polyline to reflect the M position as derived from the slider. The min and max values of the slider are the MinM and MaxM values of the polyline.
Answer
There is a .NET implementation of linear referencing in the SQL Server Spatial Tools project that you could use as a model. The SQL Server geometry types would need to be changed with their ArcObject equivalents, but the process should be similar.
The first part of the function simply loops through each vertex in a line to find which two points the M value falls between:
http://sqlspatialtools.codeplex.com/SourceControl/changeset/view/61525#230483
Then once you have the two points either side you can interpolate the postition, as shown in the InterpolateBetweenGeom function:
http://sqlspatialtools.codeplex.com/SourceControl/changeset/view/61525#230430
No comments:
Post a Comment