2

I have a file geodatabase from here: ftp://ftp.csc.noaa.gov/temp/MarineCadastre/AIS.SampleData.zip

Using ogrinfo, I can see that it contains a layer called "Broadcast_" that has lat/lon points:

C:\Users\Dirk Beer\Desktop\AIS.SampleData>ogrinfo Miami.gdb Broadcast_
INFO: Open of 'Miami.gdb'
      using driver 'FileGDB' successful.

Layer name: Broadcast_
Geometry: Point
Feature Count: 1365578
Extent: (-80.282093, 25.591130) - (-79.751260, 25.950708)
Layer SRS WKT:
GEOGCS["WGS 84",
    DATUM["WGS_1984",
        SPHEROID["WGS 84",6378137,298.257223563,
            AUTHORITY["EPSG","7030"]],
        AUTHORITY["EPSG","6326"]],
    PRIMEM["Greenwich",0,
        AUTHORITY["EPSG","8901"]],
    UNIT["degree",0.0174532925199433,
        AUTHORITY["EPSG","9122"]],
    AUTHORITY["EPSG","4326"]]
FID Column = OBJECTID
Geometry Column = Shape
SOG: Integer (0.0)
COG: Integer (0.0)
Heading: Integer (0.0)
ROT: Integer (0.0)
BaseDateTime: DateTime (0.0)
Status: Integer (0.0)
VoyageID: Integer (0.0)
MMSI: Integer (0.0)
ReceiverType: String (0.0)
ReceiverID: String (0.0)
OGRFeature(Broadcast_):1
  SOG (Integer) = 0
  COG (Integer) = 77
  Heading (Integer) = 511
  ROT (Integer) = 128
  BaseDateTime (DateTime) = 2008/12/31 23:59:00
  Status (Integer) = 0
  VoyageID (Integer) = 11
  MMSI (Integer) = 366883280
  ReceiverType (String) = b
  ReceiverID (String) = 003669972
  POINT (-80.161767 25.773433)

I would like to import that table, with the points into a MySQL database. However, when I try, the points column does not show up in the database (the column "SHAPE" contains binary data, not lat/lon points):

ogr2ogr -f MySQL MySQL:ais2,user=ais,password=ais Miami.gdb -lco ENGINE=MyISAM

show columns in broadcast_; OGR_FID SHAPE sog cog heading rot basedatetime status voyageid mmsi receivertype receiverid

How can I import the lat/lon points?

Thanks for your help.

1
1

Both your GDB file and MySQL DB do now have the spatial data -- lon-lat points -- in shape columns, but encoded as binary data. In computing, data types often have different internal and external representations.

You wish to see the data presented in lon-lat, but they are represented internally in binary. You just need to use the appropriate function to convert the points into lon-lat:

AsText (geom_column)

More info at MySQL Geometry Format Conversion Functions.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.