import gpx file to shape file

3229
4
04-02-2014 02:35 AM
aniketbabar
New Contributor
i am using arcobject .net10.1,arcmap10.1,arcgis10.1. i want a shape file which is created from .gpx file(GPS file) .i have search every where but cound'nt find any information related to my query. i am creating some code as per my knowlegde that code is not working properly. ESRI.ArcGIS.Geoprocessor.Geoprocessor gpq = new ESRI.ArcGIS.Geoprocessor.Geoprocessor(); gpq.OverwriteOutput = true;

        ESRI.ArcGIS.ConversionTools.GPXtoFeatures toolq = new ESRI.ArcGIS.ConversionTools.GPXtoFeatures();
        string qfpath = @"F:\Aniket Babar\esri project data\sample waypoint files\fells_loop.gpx";
        string qspath = @"C:\Documents and Settings\Administrator.REV3\My Documents\ArcGIS\Default.gdb\fells_loop_GPXtoFeatures1";
        toolq.Input_GPX_File = qfpath;
        toolq.Output_Feature_class = qspath;

        gpq.Execute(toolq, null);
it gives me error like"Attempting managed execution inside OS Loader lock. Do not attempt to run managed code inside a DllMain or image initialization function since doing so can cause the application to hang." if any one having a solution regarding this please send me this link or any related information.
0 Kudos
4 Replies
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
Hey,

I've got a couple applications which utilize some code I found from ESRI (can't recall exactly where, shouldn't be difficult to find). I modified it to match my needs and this is the result.

I'm not entirely sure what's wrong with your code, but it looks like it may be missing something (I'm not as familiar with C as VB.NET, so my apologies I can't convert this exactly).

' Create the geoprocessor.
        Dim gp As IGeoProcessor2 = New GeoProcessor()
        Dim pGPResult As IGeoProcessorResult = New GeoProcessorResult()

        gp.OverwriteOutput = True

        ' Create a variant array to hold the parameter values.
        Dim parameters As IVariantArray = New VarArray()
        Dim sev As Object = Nothing

        Try
            ' Populate the variant array with parameter values.
            With parameters
                .Add(sGPXFullName)
                .Add(sFDatasetPath & sTempFCName)
            End With

            ' Execute the tool.
            pGPResult = gp.Execute("GPXToFeatures_conversion", parameters, Nothing)

            ' Wait until the execution completes.
            While (pGPResult.Status = esriJobStatus.esriJobExecuting)
                Thread.Sleep(1000)
            End While

            ' Print geoprocessing messages.
            Console.WriteLine(gp.GetMessages(sev))

        Catch ex As Exception
            ' Print generic exception messages.
            Console.WriteLine(ex.Message)

            ' Print geoprocessing execution error messages.
            Console.WriteLine(gp.GetMessages(sev))

        End Try


Anyway, like I said...most of the above was straight from some ESRI documentation and my code runs just fine. Simply replace the strings where necessary. And if anyone else sees this and has comments I'd be interested to see if there's a "better" way to run this.
0 Kudos
aniketbabar
New Contributor
thank you for reply
hello sir actually i used your code but there no any change in my error it again displayed
if you have any other sample regarding this please send me link...
0 Kudos
deleted-user-VeC5jUIlNXtq
Occasional Contributor III
I found a link that may be of some use after searching your error. Hopefully it provides some useful information.
0 Kudos
aniketbabar
New Contributor
@Geoff Appleby:thanks for reply....
i get another error when i did change as per link that is[ATTACH=CONFIG]32832[/ATTACH]
if you have solution for this send let me know and if not then any sample to do this task........
0 Kudos