Register  |  Login
ThinkGeo - GPS Tracking and Mapping Solutions  |  Home  |  Cygnus Track  |   Code Community

Discussion Forums

The online community for users of Map Suite GIS components

RSS Feed Available AddThis - Bookmarking and Sharing Button Printer Friendly

PrevPrev NextNext

Map Suite FDO Extension QuickStart Guide

Posted by ThinkGeo on 08-26-2009 04:45 PM

The Map Suite FDO Extension illustrated QuickStart Guide will walk you through the process of using the new Map Suite Feature Data Objects (FDO) extension, which enables you to work with a great many more data file formats, both raster and vector. The FDO extension is included with Map Suite Desktop Edition 3.0.307 and higher, and Map Suite Web and Services Editions 3.1.124 and higher.

Disclaimer: Because the FDO extension is based on a third-party open-source code library, you may experience unexpected issues beyond ThinkGeo's control when using an FDO-supported data format.

Download Sample Code From This Exercise

We are very pleased to announce that in the latest versions of Map Suite Desktop Edition, Web Edition and Services Edition, with the help of FDO (Feature Data Objects), we now support a vast array of new data formats!

You already know that Map Suite supports these popular data formats right out of the box:

Vector Formats

Raster Formats


  • ShapeFile
  • SQL 2008
  • Oracle Spatial
  • PostgreSQL PostGIS (via extension)
  • Mr. Sid
  • ECW
  • JPEG 2000
  • BMP
  • TIFF
  • GeoTIFF

Now, with the FDO extension, you'll also have access to more than 20 new vector formats and more than 70 new raster formats, making it even easier to start using Map Suite with the data you have at your disposal.

Getting Started with FDO

To start using the FDO extension that's included with Map Suite, simply copy the folder [InstallPath]\Developer Reference\System32\MapSuiteFdoExtensionx86 to C:\Windows\System32, reference the FdoExtension.dll assembly under [InstallPath]\Developer Reference\Spatial Extensions\Fdo Extension and you'll have instant access to all of the new data formats.

Note for 64-Bit OS Users: FdoExtension.dll only works with x86 environments for now.

What's inside the FdoExtension.dll

After referencing FdoExtension.dll, there are 5 new Feature Layers we can use:

  • CommonFdoFeatureLayer
  • OgrFeatureLayer
  • PersonalGeoDatabaseFeatureLayer
  • SdfFeatureLayer
  • TabFeatureLayer

PersonalGeoDatabaseFeatureLayer supports ESRI Personal Geodatabase (.mdb).

SdfFeatureLayer supports Spatial Data File (.sdf).

TabFeatureLayer supports MapInfo Tab file (.tab).

OgrFeatureLayer supports all the formats in the following list (see here for more details):

Long Format Name Code
Arc/Info Binary Coverage AVCBin
Arc/Info .E00 (ASCII) Coverage AVCE00
Atlas BNA BNA
Comma Separated Value (.csv) CSV
ESRI Shapefile ESRI Shapefile
GeoJSON GeoJSON
Géoconcept Export Geoconcept
GMT GMT
Mapinfo File MapInfo File
Microstation DGN DGN
Memory Memory
EPIInfo .REC REC
S-57 (ENC) S57
SDTS SDTS
UK .NTF UK. NTF
U.S. Census TIGER/Line TIGER
VRT – Virtual Datasource VRT
X-Plane/Flightgear aeronautical data XPLANE

CommonFdoFeatureLayer is a superset of all the above feature layers. It supports all of the types that the above layers support. The difference is that OgrFeatureLayer deals with Data Files, while CommonFdoFeatureLayer works like a database. That's why you need to input a connection string in the constructor of CommonFdoFeatureLayer.

After referencing FdoExtension.dll, there are also 2 new Raster Layers we can use:

  • CommonFdoRasterLayer
  • GdalRasterLayer

GdalRasterLayer supports all the following types (see here for more details):

Long Format Name Code
Arc/Info ASCII Grid AAIGrid
ADRG/ARC Digitilized Raster Graphics (.gen/.thf) ADRG
Arc/Info Binary Grid (.adf) AIG
AIRSAR Polarimetric AIRSAR
Magellan BLX Topo (.blx, .xlb) BLX
Microsoft Windows Device Independent Bitmap (.bmp) BMP
BSB Nautical Chart Format (.kap) BSB
VTP Binary Terrain Format (.bt) BT
CEOS (Spot for instance) CEOS
DRDC COASP SAR Processor Raster COASP
TerraSAR-X Complex SAR Data Product COSAR
Convair PolGASP data CPG
Spot DIMAP (metadata.dim) DIMAP
ELAS DIPEx DIPEx
First Generation USGS DOQ (.doq) DOQ1
New Labelled USGS DOQ (.doq) DOQ2
Military Elevation Data (.dt0, .dt1, .dt2) DTED
ESRI .hdr Labelled EHdr
Erdas Imagine Raw EIR
NASA ELAS ELAS
ENVI .hdr Labelled Raster ENVI
ERMapper (.ers) ERS
Envisat Image Product (.n1) ESAT
EOSAT FAST Format FAST
FIT FIT
Fuji BAS Scanner Image FujiBAS
Generic Binary (.hdr Labelled) GENBIN
GSat File Format GFF
Graphics Interchange Format (.gif) GIF
WMO GRIB1/GRIB2 (.grb) GRIB
Golden Software ASCII Grid GSAG
Golden Software Binary Grid GSBG
Golden Software Surfer 7 Binary Grid GS7BG
GSC Geogrid GSC
TIFF / BigTIFF / GeoTIFF (.tif) GTiff
GXF - Grid eXchange File GXF
Erdas Imagine (.img) HFA
Image Display and Analysis (WinDisp) IDA
ILWIS Raster Map (.mpr,.mpl) ILWIS
Intergraph Raster INGR
USGS Astrogeology ISIS cube (Version 2) ISIS2
USGS Astrogeology ISIS cube (Version 3) ISIS3
JAXA PALSAR Product Reader (Level 1.1/1.5) JAXAPALSAR
Japanese DEM (.mem) JDEM
JPEG JFIF (.jpg) JPEG
NOAA Polar Orbiter Level 1b Data Set (AVHRR) L1B
Erdas 7.x .LAN and .GIS LAN
FARSITE v.4 LCP Format LCP
Daylon Leveller Heightfield Leveller
In Memory Raster MEM
Vexcel MFF MFF
Vexcel MFF2 MFF2 (HKV)
EUMETSAT Archive native (.nat) MSGN
NLAPS Data Format NDF
NITF NITF
PCI .aux Labelled PAux
PCI Geomatics Database File PCIDSK
PCRaster PCRaster
NASA Planetary Data System PDS
Portable Network Graphics(.png) PNG
Netpbm (.ppm,.pgm) PNM
Swedish Grid RIK (.rik) RIK
Raster Matrix Format (*.rsw, .mtw) RMF
Raster Product Format/RPF (a.toc) RPFTOC
RadarSat2 XML (product.xml) RS2
Idrisi Raster RST
SAR CEOS SAR_CEOS
USGS SDTS DEM (*CATD.DDF) SDTS
SGI Image Format SGI
Standard Raster Product (ASRP/USRP) SRP
SRTM HGT Format SRTMHGT
Terragen Heightfield (.ter) TERRAGEN
TerraSAR-X Product TSX
USGS ASCII DEM (.dem) USGSDEM
GDAL Virtual (.vrt) VRT
X11 Pixmap (.xpm) XPM

CommonFdoRasterLayer supports all the feature types that GdalRasterLayer supports. The difference is that GdalRasterLayer deals with Data Files, while CommonFdoRasterLayer works like a database. That's why you need to input a connection string in the constructor of CommonFdoRasterLayer.

How to Use FdoExtension for New Data Types

Let's take the MapInfo TAB format as an example. After copying the MapSuiteFdoExtensionx86 folder to C:\Windows\System32 and referencing FdoExtension.dll, you can use the TabFeatureLayer class to load, display and operate on the TAB data. TabFeatureLayer is inherited from FeatureLayer, and has the same methods/operations as other FeatureLayers in the system. Please have a look at the sample application (Extending MapSuite->TabFileFeatureLayer) that comes with the product. For a more in-depth walkthrough, here are the step-by-step instructions on how to use FdoExtension with Map Suite Desktop Edition.

Note: For the purposes of this guide, let's assume we have installed Map Suite Desktop Edition 3.0 to the default folder C:\Program Files\ThinkGeo\ Map Suite Desktop Full Edition 3.0 (BETA)\. It should be very similar for Web and Services Editions.

Setting Up the Environment

Let's start with a new Windows Forms project in the Visual Studio.NET 2008 IDE and call it HelloFdo (see Figure 1). We can create the project with .NET Framework 3.5, 3.0 or 2.0.

Screenshot

Figure 1. Creating a new project in the Visual Studio.NET 2008 IDE.

Next, we need to put a Map control on the Form. The Map control is located in the Toolbox under Windows Forms (see Figure 2). If you do not see these controls, you will need to add them to your Toolbox manually.

Adding the Map Controls to the Visual Studio.NET IDE Toolbar

1. When you first open the Visual Studio.NET IDE after installing Map Suite, you may not see the controls in the Toolbox. You will need to follow these steps to add the controls.

Hover over the Toolbox and right-click anywhere on list of controls. You will get a pop-up menu. Select "Choose Items...".

Screenshot

2. The "Choose Toolbox Items" dialogue box will appear. You will need to select the .NET Framework Components tab and then click the Browse button. Finally, navigate to the C:\Program Files\ThinkGeo\Map Suite Desktop Full Edition 3.0 (BETA)\Developer Reference\DesktopEdition folder and select the DesktopEdition.dll.

Screenshot

3. You should now have the Map control available in your Toolbox as shown in Figure 2 below.

Screenshot

Figure 2. The Map controls in the Toolbox window.

Adding the Map Control to your Windows Form

We need to add MapSuiteCore.dll and FdoExtension.dll to the reference. Right-click the project in Solution Explorer and select "Add Reference..." Navigate to the C:\Program Files\ThinkGeo\Map Suite Desktop Full Edition 3.0 (BETA)\Developer Reference\DesktopEdition folder and select MapSuiteCore.dll, and then navigate to the C:\Program Files\ThinkGeo\Map Suite Desktop Full Edition 3.0 (BETA)\Developer Reference\Spatial Extensions\Fdo Extension folder and select FdoExtension.dll.

Screenshot

Draw the Map control on the form by clicking on the Map control object in the Toolbox and then dragging and dropping (using the left mouse button) to the size you desire. You can leave the name of the Map control as winformsMap1. Our map will display in this control.

Screenshot

Copy the folder C:\Program Files\ThinkGeo\Map Suite Desktop Full Edition 3.0 (BETA)\Developer Reference\System32\MapSuiteFdoExtensionx86 to C:\Windows\System32. (see Figure 3)

Screenshot

Figure 3. Copy the MapSuiteFdoExtensionx86 folder to C:\Windows\System32.

Now that we have copied the MapSuiteFdoExtensionx86 folder to C:\Windows\System32, referenced the MapSuiteCore.dll and FdoExtension.dll, and added a Map Control, we are ready to add the code to our application.

Map Suite Desktop "Hello Fdo" Sample

In creating our "Hello Fdo" sample application, our first step is to set references to the Map Suite Core and Map Suite DesktopEdition workspaces at the very top of our code, as we will use many classes within those workspaces. We do this so that we do not have to use the fully qualified names of the Map Suite classes throughout our code. Setting a reference to the Map Suite workspace can be done in the "code-behind" of the Form by selecting the Form and hitting the F7 function key. Set the reference like this:

using ThinkGeo.MapSuite.Core;
using ThinkGeo.MapSuite.DesktopEdition;

This sample will show you how to draw a map with the MapControl using your own TAB data. At the very beginning, let's have a look at the data we will use. (See Figure 4)

Screenshot

Figure 4. HoustonMuniBdySamp_Boundary.TAB, the data we will use in this sample.


private void Form1_Load(object sender, EventArgs e)
        {
            winformsMap1.MapUnit = GeographyUnit.DecimalDegree;
            winformsMap1.CurrentExtent = new RectangleShape(-96.51477, 30.759543, -94.355788, 28.910652);
            winformsMap1.BackgroundOverlay.BackgroundBrush = new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean);

            // Create a TabFile Feature Layer.
            // FID:                         ID Column Name
            // OGRSchema:                   Feature Schema Name. For most cases in Tab, it's "OGRSchema"
            // HoustonMuniBdySamp_Boundary: Feature Class Name. For most cases in Tab, it's the File Name
            // GEOMETRY:                    Geometry Column Name. 
            // TabFileFeatureLayer worldLayer = new TabFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Full Edition 3.0 (BETA)\Samples\SampleData\Data\HoustonMuniBdySamp_Boundary.TAB", "FID", "OGRSchema", "HoustonMuniBdySamp_Boundary", "GEOMETRY");

            // Above is a common constructor of Fdo Feature Layer, Specific for Tab File, you can use the following simpler one for most of cases.
            // It will use "OGRSchema" as the Schema Name, use "HoustonMuniBdySamp_Boundary" as the Class Name, 
            // and use the name of the first Geometry Column if found as the Geometry Column Name
            TabFileFeatureLayer worldLayer = new TabFileFeatureLayer(@"C:\Program Files\ThinkGeo\Map Suite Desktop Full Edition 3.0 (BETA)\Samples\SampleData\Data\HoustonMuniBdySamp_Boundary.TAB", "FID");

            worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
            worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;

            // Add the TabFile Feature Layer to a Layer Overlay.
            LayerOverlay staticOverlay = new LayerOverlay();
            staticOverlay.Layers.Add("WorldLayer", worldLayer);
            winformsMap1.Overlays.Add(staticOverlay);

            // Draw the map.
            winformsMap1.Refresh();
        }

If you compile and run what you have now, your map should look like the one below. (See Figure 5)

Screenshot

Figure 5. The map from HoustonMuniBdySamp_Boundary.TAB.

Navigate the Map

With the above code, not only can you display a map, but you can also navigate it. You can pan by dragging the map, zoom in by double-clicking, zoom out by double-right-clicking, track zoom in by drawing a rectangle with your left mouse button while holding the shift key, or zoom in and out by using the mouse wheel. Very powerful for just a couple lines of code, isn't it?

If you have any questions or want to leave feedback for us, feel free to post your comments below, or in the 3.x Support Forums for the product you're working with — be it Desktop Edition, Web Edition or Services Edition. You can also contact us using one of the methods below:

Pre-Sales & Customer Support: ThinkGeo Customer Portal
Support Phone: 1-866-847-7510
1-785-727-4133 (Outside North America)
Web Site: http://thinkgeo.com

Download Sample Code From This Exercise

11 Comments

Lars I.User is Offline
11-11-2009 05:56 AM
Avatar
Adding a web example too would be great.

Wouldn't it beneficial to discuss FDO related questions in a separate forum ?
BenUser is Offline
11-13-2009 03:35 AM
Avatar
Lars I.

Thanks for the suggestion. This sample is integrated in WebEdition's HowDoI samples, please have a look at there. The code is very similar to the Desktop one.

About creating a separate forum for FDO, I'm not very sure as our forums are based on the products and FDO is in fact a third part stuff. We will have a discussion and let you know the result. Thanks again for the advice!

Thanks,

Ben
DavidUser is Offline
11-15-2009 07:42 PM
Avatar
Lars,

We will keep that suggestion in mind. Currently we do not get enough activity to warrant a forum of its own. It is tough spot we are in because we do not support FDO itself, just the wrapper we wrote for it. I am also afraid if we had a forum people would expect us to support FDO proper and all of the formats it supports. We wrote the FDO wrapper to allow people to try it and if it works well then that is great and if not there is not much we can do outside of changing the wrapper code which is not very large. Of course we will try to support it as we can.

David
fatimaUser is Offline
12-21-2009 12:19 PM
Avatar
O.K can someone please help me with this. I installed the software and i was trying to follow the steps in order to find the formats and get started with the FDO, but i cant seem to do right !
DavidUser is Offline
12-21-2009 12:31 PM
Avatar
Fatima,

Can you provide a little more insight into where things went wrong. The more information you can provide the better we can help you. Were you able to walk through the Quick Start Guide? If you were not able to which step did you have an issue with?

David
fatimaUser is Offline
12-21-2009 12:36 PM
Avatar
I cant follow the steps in the above part that says "Getting Started with FDO"
YaleUser is Offline
12-21-2009 06:44 PM
Avatar
Fatima,

Could you let us know what kind of OS you are runing against? and you are using the last public release 3.1.299?

Thanks.

Yale
VivekUser is Offline
05-18-2010 01:46 AM
Avatar
Hii I am using ThinkGeo and want to know how to cache google maps so that we can use it in offline mode with ThinkGeo MapSuite.
YaleUser is Offline
05-24-2010 03:52 AM
Avatar
Vivek,

Thanks for your input. I think we have talked about the Google map caching stuff in Ticket 2683.

If I made anything wrong, just feel free to let me know.

Thanks.

Yale
DonUser is Offline
07-02-2010 02:01 PM
Avatar
.mxd file
how do I view it?
YaleUser is Offline
07-04-2010 09:57 PM
Avatar
Don,

As far as I know, .mxd file is map file format used by ESRI mapping software, such as ArcMap that is the central application used in ArcGIS. mxd file is saved in a compound format that includes the map description, layout, and embedded objects saved in the map and organized into units called storages and streams.

MXD file can be opened by ArcGIS License Manager - ArcGIS is the name of a group of geographic information system software product lines produced by ESRI. Unfortunately, we do not support it in MapSuite component up to now.

Any more questions just feel free to let me know.

Thanks.

Yale
You are not authorized to post a reply.
Active Forums 4.2