Results 1 to 8 of 8
  1. #1
    Join Date
    Jan 2012
    Posts
    13

    Question Unanswered: Spatial Extender: Cannot import shape files using Control center

    I am a new user of DB2 spatial extender, I tried to import a shp file into one spatial column of my table using control center, but no success! I am using DB2 Enterprise 9.7, spatial extender 9.7 with windows server 2008.

    Firstly, I created a Spatial Reference system called "Ashortcut" ID "999999999" with WGS1984UTMzone37S (same as my shape file) and register my spatial column with it.

    Then, I try to import shape file using "Import Spatial Data" window:
    1. Choose "File format" as "Shape".
    2. Choose "File name" in my local file system. (You seem can only choose one file? I choose the *.shp one. No idea if it is right since shape files contains at least 5 files.)
    3. Choose the spatial column of my table.
    4. Choose the spatial reference system as "Ashortcut".
    5. Finish.

    Then I will get an error message saying: "GSE1002N A required argument, "spatialColumn", was not specified." So I dismiss the error message window, choose again my spatial column ( I already chose it!), and try again.

    Then I got error message saying: "GSE2117N The coordinate system definition "PROJCS["UTM Zone 37, Southern Hemisphere",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",39],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]" does not match the coordinate system definition on which the spatial reference system "999999999" is based."

    What does the error mean?? Googled whole day and found nothing...could anyone help me please?
    Last edited by Kilimanjaro; 01-20-12 at 11:21.

  2. #2
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You are right, a "shape file" is comprised of multiple real files. All have to have the same base name and that's the way related files are identified. So you can either specify only the base name of the files or you use the .shp file (upper/lower case for the .shp extension doesn't matter).

    As for the error message: which coordinate system (spatial reference system) was used for the data you try to import? I don't recall if the DB2 Control Center has an interface, but you can use the "db2se" command line with the option "shape_info". It will tell you the details of the coordinate system in the .proj file. If you specify a DB2 database to connect to, shape_info will scan the spatial extender's catalog tables and tell you which matching spatial reference systems/coordinate systems you can use (if a matching system is found).

    A little bit on the background: there are many, many different coordinate systems used for different situations. You may use longitude/latitude coordinates, for example. In that case, you may use a different definition for the center of the earth (e.g. depending on the height of the area you want to track), a different prime meridian (e.g. Greenwich may not be that optimal for coordinates on the other side of the globe) or other settings like differences in the assumed flattening of the earth or earth radius.

    Furthermore, there are a lot of different ways to do the projection for projected coordinate systems (which you can actually print on a sheet of paper). Each and every projection algorithm causes distortions in some way - since you go from 3D to 2D space. For example, distances are always wrong (except is special cases only, e.g. along a couple lines in conical projects). Each projection algorithm has different strengths and weaknesses. Just remember that the North Pole or South Pole on well-known rectangular maps for the world are the upper/lower borders, i.e. a rather long line (equal length as equator in the middle), but in reality both are just single points.

    Also, projected coordinate systems often don't work with latitude/longitude but other ranges for the coordinate values. Similarly, geographic coordinate systems may have different precisions for the data. Using a precision down to a few centimeters is surely cool, but you'll have a hard time to get data that accurate. So you are typically in the range of a few meters or so.

    Taking all this into account, you should make sure that your coordinate value range and the coordinate system really matches the data. Otherwise, you may be able to load the data, but cannot use it correctly because various errors exist.
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  3. #3
    Join Date
    Jan 2012
    Posts
    13
    Thank you very much for the kind help!

    I defined my projection of shapefile as WGS84 UTM zone 37 S in ArcGIS.
    Here is the projection infor of *.prj file:
    PROJCS["UTM Zone 37, Southern Hemisphere",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",39],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]

    I tried to define the same projection in db2 control center, spatial extender option. Here you have the option to select your Spatial reference system. But there are 324 items in the selection window and none of them is the correct one. So I am forced to use the option "Create".
    In the "Create Spatial Reference System" window, I have to give a name and ID, and define my Coordinate system as the correct one. After that, the newly created spatial reference system name will appear in the selection window and I am able to choose it.

    But after the choose the spatial reference I just created, I get this error message saying: "GSE2117N The coordinate system definition "PROJCS["UTM Zone 37, Southern Hemisphere",GEOGCS["WGS 84",DATUM["WGS_1984",SPHEROID["WGS 84",6378137,298.257223563,AUTHORITY["EPSG","7030"]],TOWGS84[0,0,0,0,0,0,0],AUTHORITY["EPSG","6326"]],PRIMEM["Greenwich",0,AUTHORITY["EPSG","8901"]],UNIT["degree",0.0174532925199433,AUTHORITY["EPSG","9108"]],AUTHORITY["EPSG","4326"]],PROJECTION["Transverse_Mercator"],PARAMETER["latitude_of_origin",0],PARAMETER["central_meridian",39],PARAMETER["scale_factor",0.9996],PARAMETER["false_easting",500000],PARAMETER["false_northing",10000000],UNIT["Meter",1]]" does not match the coordinate system definition on which the spatial reference system "999999999" is based."

    I wonder it might be because the ID I gave to the created spatial reference system is already used as some predefined spatial reference system. I changed the ID for several times but always got the same error message.

    I think it makes no sense that you have to give an ID but you need big luck to choose a number that has not been used.

    Maybe I have to use the command line to make it work. Just to have a user interface but cannot use it is not really encouraging.

  4. #4
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    I would really urge you to use the "shape_info" option I mentioned to get some information about the data in the file. For example, the min/max coordinates could be a clue. Using "shape_info" with the -database option should be helpful.

    Regarding the ID: this one is important because spatial functions (used in queries working with the data) typically receive the ID of the spatial reference system (SRS) as input parameter. That's why you have to choose your own ID. The only requirement is that it is an INT value and is not being used by an existing SRS. Hence, you can pick any number you like. If there would be a collision with an existing SRS, you'll get an error when you try to create your own SRS.

    The extender comes with a few 1000 pre-defined coordinate systems. You shouldn't define your own one. But there is a high chance that you'll have to define your own spatial reference system. The SRS is a coordinate system with some additional parameters attached. Those parameters define, for example, how floating point coordinate values are to be converted into positive integers, which are used internally. (Positive integers are used to improve performance for internal calculations with geometries and also to store the data in a compressed format.)

    What I find strange in your original error message is this: "UTM Zone ** - why are there 2 '*'? This is usually a number.

    Anyway, please run shape_info with the -database option and post the output it produces. ('m not quite sure if it is "shape_info" or "info_shape"; I'm also not completely sure if the option is "-database" or something else - it's been 10 years when I worked on that. But you can have a look at the db2se help (option -h or so) and also the help for shape_info itself (also option -h, I believe).
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  5. #5
    Join Date
    Jan 2012
    Posts
    13
    Thank you so much for the fast reply!

    I tried to project my shape file again in case there is any error in shape file.

    After that I tried the command db2se as:
    db2se shape_info -filename ~/GISData/MyShape -database Mydatabase

    And get result:

    Shape file information
    ----------------------
    File code = 9994
    File length (16-bit words) = 1002
    Shape file version = 1000
    Shape type = 1 (ST_POINT)
    Number of records = 68

    Minimum X coordinate = 299290,000000
    Maximum X coordinate = 353790,000000
    Minimum Y coordinate = 9625615,000000
    Maximum Y coordinate = 9663426,000000
    Shapes do not have Z coordinates.
    Shapes do not have M coordinates.

    Shape index file (extension .shx) is present.

    Coordinate system definition: "PROJCS["WGS_1984_UTM_Zone_37S",GEOGCS["GCS_WGS_19
    84",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137.0,298.257223563]],PRIMEM["Gre
    enwich",0.0],UNIT["Degree",0.0174532925199433]],PROJECTION["Transverse_Mercator"
    ],PARAMETER["False_Easting",500000.0],PARAMETER["False_Northing",10000000.0],PAR
    AMETER["Central_Meridian",39.0],PARAMETER["Scale_Factor",0.9996],PARAMETER["Lati
    tude_Of_Origin",0.0],UNIT["Meter",1.0]]"

    Compatible coordinate systems
    -----------------------------
    WGS_1984_UTM_ZONE_37S

    Compatible spatial reference systems
    ------------------------------------
    999999999 ASHORTCUT


    It seems it finds the spatial reference systems I have defined.

    I tried again upload the shape file and got another error:
    "GSE2102N The data type "null"."null" to be used during import is unknown to DB2."

    This error shows that the data type MyShape.shp to be used during import is unknown to DB2? Totally strange...

    PS: I am sorry for the ** in the original error code. It should be 37. I thought the number of zone does not matter so I replaced it with general two digits number **. Forgive me if that gives confusion.
    Last edited by Kilimanjaro; 01-23-12 at 10:50.

  6. #6
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You are right: the SRS matches and you should be able to use it successfully.

    There is something strange. GSE2102N is a different error message: GSE2102N Did you get error GSE2101 by any chance?

    I really have no idea what may be causing the error. Just a guess - does the table you want to import into already exist or is it to be created for you during the import?
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

  7. #7
    Join Date
    Jan 2012
    Posts
    13
    Thank you very much for the hint!

    I imported the shape file again and got GSE2101N error (I am very sure I got the GSE2102N error the first time I tried it, but it never came up again). I created a new table and then imported the shape file with control center, still had the same error.

    I finally gave up trying to upload by control center and tried command "db2se import_shape" and it worked perfectly. I guess the DB2 control center for spatial extender might still need some effort to become perfect.

    Anyhow thank you very much for all your help and I learned sth new and useful. Wish you all the best in the new year!

  8. #8
    Join Date
    Jan 2007
    Location
    Jena, Germany
    Posts
    2,721
    You're welcome! I'm glad things are working for you now.

    p.s: Unfortunately, I can't comment on the Control Center - I haven't worked on that code. But I was active on "db2se", so I still recall a few details on that. ;-)
    Knut Stolze
    IBM DB2 Analytics Accelerator
    IBM Germany Research & Development

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •