Tuesday, March 3, 2009

Export KML to DXF with GeoMedia

GeoMedia 6.1 can read and display KML files. Once you are able to connect to the KML warehouse, you can use any GeoMedia command to manipulate the KML features. The Output to Feature Class and Export Warehouse commands are also available for you to convert KML features into other formats such as Access, Shape files, DGN, DWG, etc. However, I encountered some difficulty in exporting KML features to DXF. If you tried to run the Export to DXF command as shown below, you will encounter this "Exporting query on image feature class not supported" error message.


This posting describes a method that I used to manipulate the data to enable GeoMedia to export the KML features to DXF successfully. The issue is that the KML format supports embedded raster images while the Export to DXF command is not able to handle raster geometries. So the workaround is to import the KML features into an Access warehouse first, delete the raster geometry database field, update the metadata, then export the KML features in Access to DXF. Details are below.

Import KML features into Access 
  1. In GeoMedia, select Warehouse | New Connection.

    The New Connection dialog box appears.


  2. In the Connection type list box, select KML.



  3. In the KML file field, click Browse and select a KML file. You can leave the Warehouse configuration file field blank.

  4. Click OK.

    GeoMedia is now connected to the KML file.

  5. Select Warehouse | Output to Feature Classes.

    The Output to Feature Classes dialog box appears.

  6. In the Source features to output box, toggle on the KML feature. In the Target connection drop down list, select a read/write Access warehouse connection. Note: If you don't have one, then connect to one or create a new Access Warehouse first.

    The Output to Feature Classes dialog box may look this.


  7. Click the Advanced tab.

  8. In the Target Feature Class field, type in a new name e.g. google if you do not like the default name.

    The Output to Feature Classes dialog box may look like this.


  9. Click OK and Yes when prompted.


    The KML features are imported into the target Access warehouse. Notice that the KML feature has 3 geometry types - text, raster and compound.


  10. Exit GeoMedia.
Delete the KML feature's Raster geometry field
  1. In Microsoft Access, select File | Open.

    The Open dialog box appears.

  2. In the File name field, type in the name of the Access warehouse file and click Open.

    The selected database is opened in Microsoft Access.

  3. In Microsoft Access, select the KML table name imported from the KML file previously, e.g. google.

  4. Click Design.

    The Table form is displayed.

  5. Click the gray box on the left of the RasterGeometry field name.

    The RasterGeometry row is highlighted.


  6. On the keyboard, press Delete. Click Yes when prompted.

    The RasterGeometry field is removed from the form.


  7. Close the table form and click Yes when prompted.

    The RasterGeometry field is deleted from the table.

  8. Exit Microsoft Access
Update the Access Warehouse Metadata
  1. On the Windows desktop, select Start | All Programs | GeoMedia | Utilities | Database Utilities.

    The Database Connection dialog box appears.

  2. In the Access database name field, click Browse and select the Access warehouse file.

    The Database Connection dialog box may look like this.


  3. Click OK.

    The Database Utilities dialog box appears.


  4. Click Delete Feature Class Metadata.

    The Delete Feature Class Metadata dialog box appears.


  5. In the Feature classes list box, select the KML feature e.g. google. Click OK.

    The metadata for the KML feature is removed.

  6. In the Database Utilities dialog box, click Insert Feature Class metadata.

    The Insert Feature Class Metadata dialog box appears.

  7. In the Available tables/views list box, select the KML feature. Click the '>' button.

    The Insert Feature Class Metadata dialog box may look like this.


  8. Click OK.

    The Select Coordinate System dialog box appears.


  9. Click Assign and close the dialog box.

    The KML feature metadata is regenerated and added back this time without the metadata for the rasterGeometry field.

  10. Close the Database Utilities dialog box.

Export to DXF
Now you can perform the export to DXF successfully.
  1. In GeoMedia, open up the connection to the Access warehouse again.

  2. Select Warehouse | Export to | AutoCAD.

    The Export to AutoCAD dialog box appears.


  3. In the Features to export field, select the KML feature. Change any other settings if you wish.

    The dialog box may look like this.


  4. Click Apply.

    The KML feature is exported to DXF

No comments: