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 exportForMyabudhabinetToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var mOPFn = SelectOutputFilename(null, "myabudhabi_net_ddl.sql", "SQL|*.sql");

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

            var mLyr = ExtFunctions.GetSelectedAddressUnitLayer(theMap);

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

            ExtFunctions.ExportToMyAbuDhabiNet(
                mOPFn,
                mLyr,
                theMap.Projection,
                ExtFunctions.GetProjByEPSG(4326),
                false,
                SignType.addressUnitNumberSign);
        }
        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 exportAddressUnitsToMySQLToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var mLyr = ExtFunctions.GetSelectedAddressUnitLayer(theMap);

            if (mLyr == null)
            {
                return;
            }

            var frm = new frmMySQLConnection(this, mLyr);

            if (frm.ShowDialog() != DialogResult.OK)
            {
                return;
            }
        }
        private void exportAddressUnitsToGeopaparazziProjectToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var mLyr = ExtFunctions.GetSelectedAddressUnitLayer(theMap);

            if (mLyr == null)
            {
                return;
            }

            var mOPFn = SelectOutputFilename(null, mLyr.LegendText + ".zip", "Compressed archive|*.zip");

            if (mOPFn == null)
            {
                return;
            }

            ExtFunctions.ExportToGeopaparazzi(mLyr, mOPFn, theMap.Projection, KnownCoordinateSystems.Geographic.World.WGS1984);
        }
        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 exportAddressUnitsToSQLITEDbToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var mLyr = ExtFunctions.GetSelectedAddressUnitLayer(theMap);

            if (mLyr == null)
            {
                return;
            }

            var mOpFn = SelectOutputFilename(null, mLyr.LegendText + ".sqlite", "SQLite database|*.sqlite", false);

            if (mOpFn == null)
            {
                return;
            }

            ExtFunctions.ExportToSQLiteDatabase(
                mLyr,
                mOpFn,
                theMap.Projection,
                ExtFunctions.GetProjByEPSG(4326));
        }