Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer 1

up vote 0 down vote accepted

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

share|improve this answer
1  
Arcobjects isn't used on client side. It looks like polylines in both the spatial data service as well as the Silverlight/WPF SDK help.arcgis.com/en/webapi/silverlight/apiref/… do not contain M values, which is likely a limitation of the REST API's polyline. I'm wondering what the easiest way to retrieve feature xym's from the mapservice. –  Kirk Kuykendall Mar 1 '11 at 22:52
    
@kirk - as long as you know which are the start and end nodes of the line you can use the above algorithm to calculate the point's position. You just need to keep track of segment lengths. I did something similar in JS / OpenLayers. –  geographika Mar 2 '11 at 0:02
    
Thanks, I think I got that figured out. I was hoping to find an easy way to retrieve M's from the server. It looks like I'll need to use a SOAP call. –  Kirk Kuykendall Mar 2 '11 at 15:42
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.