Implementing IRouteMeasureCreator2.CreateUsingPoints method

05-14-2013 11:41 PM
New Contributor II

I'm facing a problem here when trying to mimic IRouteMeasureCreator2 interface functionality to create routes using calibration points.
What I'm trying to do here is that I am basically trying to replicate that functionality available at "Route editing" toolbar ("Make route" tool), where I can create a route on object level (geoprocessing tool "Creat routes" operates on layer level and is hence not suitable for me) by selecting the starting point of that route. This is crucial - I want my tool to select starting point programmatically from another point layer and further use points from in-memory workspace as calibration points.

In that temporary point featureclass created via InMemoryWorkspaceFactory I have two calibration points for one route - startpoint and endpoint. And I have successfully written attribute values which will hold needed M-values for creating a route.

Now, if calling
pRouteCreator.CreateUsingPoints(pSelSet, "TEE2", "MEASURELENGTH", 1, True, 0.5, False, pFeatClassName, geomdef, "", Nothing)

I get "The parameter is incorrect" (E_INVALIDARG) error.
I haven't found out where I went wrong... and also ESRI documentation is laconic about those parameters. Couldn't find any examples using .CreateUsingPoints aswell.

So one or two hints would probably guide me out:
1) Any working example implementing IRouteMeasureCreator2.CreateUsingPoints method
2) Any helping comment on the subject whether it is possible to create route from selected features using calibration points at all (via ArcObjects).   

My platform is ArcGIS 10.1 and VB.NET.

Thank you.
Raivo Alla,
Estonian Land Board
0 Kudos
1 Reply
New Contributor II
Luckily I found solution, my pFeatClassName was declared abit carelessly, in case anyone will find it useful:
            Dim targetWorkspaceIName As IName = CType(TempWorkspaceName, IName)
            Dim targetWorkspace As IWorkspace = CType(targetWorkspaceIName.Open(), IWorkspace)
            Dim pFeatClassName As IFeatureClassName = New FeatureClassNameClass()
            With (pFeatClassName)
                .FeatureType = esriFeatureType.esriFTSimple
                .ShapeFieldName = "Shape"
                .ShapeType = esriGeometryType.esriGeometryPolyline
            End With
            Dim targetDatasetName As IDatasetName = CType(pFeatClassName, IDatasetName)
            targetDatasetName.Name = "tervikteed"
            targetDatasetName.WorkspaceName = TempWorkspaceName 

0 Kudos