private void exportSelectedLayerAsKMLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IFeatureLayer mLayer;

            if (null != (mLayer = ExtFunctions.GetSelectedAddressUnitLayer(theMap)))
            {
                dlgSaveFile.Title    = "Choose where to save the exported KML file";
                dlgSaveFile.Filter   = "Keyhole Markup File (KML)|*.kml";
                dlgSaveFile.FileName = theMap.Layers.SelectedLayer.LegendText + ".kml";
                if (dlgSaveFile.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    var mReturnValue = ExtFunctions.ExportFeatureLayerToOGR(
                        pDrvNm: "KML",
                        pFLyr: (IFeatureLayer)theMap.Layers.SelectedLayer,
                        pOPFn: dlgSaveFile.FileName,
                        pHasTitle: true,
                        pSrcProj: theMap.Projection,
                        pTgtProj: ExtFunctions.GetProjByEPSG(4326),
                        pTitleFieldNames: "ADDRESSUNITNR",
                        pTitleFormat: "#{0}");

                    SetFunctionExecutionStatus(mReturnValue);
                }
            }
            else
            {
                Utilities.LogDebug("No layer selected");
            }
        }
        private void exportSelectedLayerAsFileGDBToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IFeatureLayer mLayer;

            if (null != (mLayer = ExtFunctions.GetSelectedAddressUnitLayer(theMap)))
            {
                string mOutputFilename;

                if (null != (mOutputFilename = SelectOutputFilename(null, mLayer.LegendText, "File GDB|*.gdb")))
                {
                    var mReturnValue = ExtFunctions.ExportFeatureLayerToOGR(
                        pDrvNm: "FileGDB",
                        pFLyr: (IFeatureLayer)theMap.Layers.SelectedLayer,
                        pOPFn: dlgSaveFile.FileName,
                        pSrcProj: theMap.Projection,
                        pTgtProj: ExtFunctions.GetProjByEPSG(32640),
                        pLCOpts: new List <string>()
                    {
                        "FEATURE_DATASET=Simplified"
                    });

                    Log(mReturnValue.GetMessages());
                    Log("Operation completed");
                }
                else
                {
                    Log("Operation cancelled: No output FileGDB name specified");
                }
            }
            else
            {
                Log("Operation cancelled: No layer selected");
            }
        }
        private void exportSelectedPointLayerAsGPXToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IPointLayer mLyr = ExtFunctions.GetSelectedAddressUnitLayer(theMap);

            if (mLyr == null)
            {
                Utilities.LogDebug("No point layer was selected");
                return;
            }

            var mOPFn = SelectOutputFilename(null, mLyr.LegendText + ".gpx", "GPS Exchange Format|*.gpx");

            if (mOPFn == null)
            {
                Utilities.LogDebug("No filename specified");
                return;
            }

            var mFieldMap = new Dictionary <string, string>();

            mFieldMap.Add(ExtFunctions.TitleFieldName, "name");
            mFieldMap.Add("ROADNAME_EN", "desc");

            var success = ExtFunctions.ExportFeatureLayerToOGR(
                pDrvNm: "GPX",
                pFLyr: mLyr,
                pOPFn: mOPFn,
                pSrcProj: theMap.Projection,
                pTgtProj: ExtFunctions.GetProjByEPSG(4326),
                pHasTitle: true,
                pTitleFieldNames: "ADDRESSUNITNR,ROADID",
                pTitleFormat: "wpt{0}-{1}",
                pDSCOpts: new List <string>()
            {
                "GPX_USE_EXTENSIONS=NO"
            },
                pFieldMap: mFieldMap,
                pOnlyInFieldMap: true
                );
        }
        private void exportSelectedFeatureLayerToSpatialiteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            IFeatureLayer mLyr = ExtFunctions.GetSelectedFeatureLayer(theMap);

            if (mLyr == null)
            {
                return;
            }

            string mOPFn = SelectOutputFilename(null, mLyr.LegendText + ".sqlite", "Spatialite|*.sqlite");

            if (mOPFn == null)
            {
                return;
            }

            var mDSCOpts = new List <string>();

            mDSCOpts.Add("SPATIALITE=YES");

            var mLCOpts = new List <string>();

            mLCOpts.Add("SPATIAL_INDEX=YES");

            var mReturnValue = ExtFunctions.ExportFeatureLayerToOGR(
                "SQLite",
                mLyr,
                mOPFn,
                theMap.Projection,
                ExtFunctions.GetProjByEPSG(4326),
                false,
                null,
                null,
                mLCOpts,
                mDSCOpts);

            SetFunctionExecutionStatus(mReturnValue);
            return;
        }
 private void importRoadsAndRoadCenterLinesToolStripMenuItem_Click(object sender, EventArgs e)
 {
     // Add select dialog here...
     dlgOpenMdbFile.Filter   = "Addressing Database|*.mdb";
     dlgOpenMdbFile.FileName = "*.mdb";
     if (dlgOpenMdbFile.ShowDialog() == DialogResult.OK)
     {
         var mRoadsFeatureSet = ExtFunctions.GetRoadFeatureSetFromAdmAdrMdb(ref this.pgBar, Log, dlgOpenMdbFile.FileName, 1);
         var mRoadsLayer      = ExtFunctions.GetFeatureLayer(theMap.Layers, mRoadsFeatureSet, "SimplifiedRoads", MapSymbols.LineSymbol(SignColors.AddressUnitSign, 2), KnownCoordinateSystems.Projected.UtmWgs1984.WGS1984UTMZone40N);
         dlgSaveFile.Filter = "FileGeodatabases|*.gdb";
         dlgSaveFile.Title  = "Save imported roads to ESRI FileGDB";
         if (dlgSaveFile.ShowDialog() == DialogResult.OK)
         {
             try
             {
                 ExtFunctions.ExportFeatureLayerToOGR("FileGDB", mRoadsLayer, dlgSaveFile.FileName, KnownCoordinateSystems.Projected.UtmWgs1984.WGS1984UTMZone40N, KnownCoordinateSystems.Projected.UtmWgs1984.WGS1984UTMZone40N);
             }
             catch (Exception ex)
             {
                 Log("Operation cancelled");
                 Log(ex.Message);
             }
         }
         else
         {
             Log("Export to FileGDB cancelled");
         }
         if (MessageBox.Show("Would you like to add the imported roads to the map?", "Import roads", MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
         {
             mRoadsLayer.Reproject(theMap.Projection);
             theMap.Refresh();
         }
     }
     else
     {
         Log("Operation cancelled, please select an addressing database file");
     }
 }