Import_to_spatial_database command

htuserhtuser Global Mapper UserPosts: 35Trusted User
edited June 2015 in GM Script Language
Dear all,
i'm writing a script to import thousands files from a geodatabase and export them to another spatial database. The first step, but i don't know the command to export them to the spatial database.
Please, can someone help me?
Thanks in advance.

Comments

  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited January 2014
    I would like to write the Export Vector Spatial Database Command into GM script!
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,688
    edited January 2014
    Hello,

    Thank you for using Global Mapper.
    htuser wrote: »
    I would like to write the Export Vector Spatial Database Command into GM script!

    At the moment, the ability to export vector data to a spatial database is not available via a Global Mapper script command. I have added item #12759 to our task list, requesting that this be implemented.

    Cheers,

    Bob
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited January 2014
    Thanks for your quick answer. I hope this upgrade will be available for 14.2 GM user. Please let's me know when this command is implemented.
    Sincerely yours,
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,688
    edited January 2014
    Hello,

    I will post a message on this forum thread when the function has been implemented. You will need to upgrade to the latest version in order to get this new script command.

    Cheers,

    Bob
  • kuitgkuitg Global Mapper User Posts: 22Trusted User
    edited January 2014
    Hallo Bob

    I have latest version 15. Any news on this script command upgrade.

    Regards
    Geert
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2014
    Geert,

    The new command isn't quite ready yet, but as soon as we have it working in a v15 build we will post a link to it here.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited January 2014
    Hi Mike and Bob,
    does it possible to include the possibility to export vector in spatial database with the same name that the files are displayed in GM automatically?
    I would like to know if it's possible to have scripts to split line by points?
    I'm waiting for it before upgrade to the latest version.
    Thanks in advance.
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2014
    Once we have a script command to write out the vector spatial database then it would certainly be possible to create the databases using the names of the loaded files using script variables and looping. Also splitting layers by attributes is already in the script so that would work as well. It is just the script command to export to a vector spatial database that doesn't exist yet.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited January 2014
    "Also splitting layers by attributes is already in the script so that would work as well"
    Never i can split a line by points. This must cut a line by points, not by attribute. Are you sure that a such tools or script function exist for doing that on GM?

  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2014
    Oh sorry I read that wrong! I could add an option to the EDIT_VECTOR command to create a point from each vertex of a line similar to the existing option to do this with the Digitizer Tool. Do you just need something so the following works?

    EDIT_VECTOR CREATE_VERTEX_POINTS=YES

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited January 2014
    It's something different. Split line by points using two differents layers: a line and a point. This function using the point point layers to split the line at each point...
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2014
    So you have a layer with point features and another with lines and you want to split whatever line is closest to each point at whatever location the point would snap to the line? So there would maybe be a new SPLIT_LINES_AT_POINTS parameter that took as its value the layer name to get the points from (or just adding SPLIT_LINES_AT_POINTS=YES could split the lines from points in the same layer)?

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited January 2014
    Dear Mike,
    This algorithm already exist in other GIS software. This divide a line to polyline creating another file at the intersection of a point or at the closest point.

    "So you have a layer with point features and another with lines and you want to split whatever line is closest to each point at whatever location the point would snap to the line?" YES

    Please take a look on the followings link.
    Split Lines At Points
    ArcGIS Desktop
    ST_Split
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited January 2014
    I've added a todo item (#12915) to add an option to the EDIT_VECTOR script command to split matching line features where points from some layer snap to them within some distance threshold. I'll let you know when this new functionality is available to try.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • global_mapperglobal_mapper Administrator Posts: 17,238
    edited February 2014
    I've updated the scripting language so you can now split lines against points from some layer using the EDIT_VECTOR script command. Add a new POINT_LAYER_TO_SPLIT_AGAINST parameter to specify the name of the point layer to split the lines against. If you add a MAX_DIST parameter you can specify the maximum distance in meters for the point from the line. Otherwise any distance is ok.

    I have placed a new build at http://www.bluemarblegeo.com/downloads/global-mapper/global_mapper15.zip with the latest changes for you to try. Simply download that file and extract the contents into your existing v15.xx installation folder to give it a try. If you are using the 64-bit v15 version there is a new build at http://www.bluemarblegeo.com/downloads/global-mapper/global_mapper15_64bit.zip .

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited February 2014
    Thanks for this quick upgrade who's very useful for users.
    I would like to know about the item #12759: Export Vector Spatial Database Command into GM script?
    I'll try it and send comments in the forum.
    Sincerely yours,
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,688
    edited February 2014
    Hello,
    htuser wrote: »
    I would like to know about the item #12759: Export Vector Spatial Database Command into GM script?

    You can use the EXPORT_VECTOR script command to export vector data to a spatial database table if you have GM 15.1.4 or higher.

    If you want to export to a spatial database that requires a connection, such as MS SQL Server or Esri ArcSDE, then you will need to define a connection using either the Global Mapper Connection Manager or the new DEFINE_SDB_CONNECTION script command. If you want to export to a file-based spatial database, such as SQLite or Esri File Geodatabase, then you only need to specify the file name for the database. In either case, you will need to specify the export table name using the new SDB_TABLE_NAME parameter.

    The documentation can be found here. (Scroll to the bottom of the EXPORT_VECTOR page to see the new parameters associated with spatial databases.)

    Cheers,

    Bob
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited October 2014
    Dear Mike and Bmg_Bob,
    It's the first time that i use a script to load automatically data in a spatial database with the following script.

    EXPORT_VECTOR TYPE="" SHAPE_TYPE="AREAS" SDB_CONNECTION_NAME="XXX" \
    SDB_SERVER="212.268.0..0" SDB_PORT="XXX" SDB_DATABASE_NAME="DB_sample" \
    SDB_SAVE_USER_AND_PASSWORD="YES" SDB_USER_NAME="user" \
    SDB_PASSWORD="1234" SAVE_CONNECTION=YES \
    SPLIT_BY_LAYER=YES\
    SDB_TABLE_NAME="" LABEL_FIELD_FORCE_OVERWRITE="NO"\
    But, unfortunately, i've two problems...after loading a lot of files...
    1.- I can't load data with the same name that they are load in postgis using an command to "Split data by feature layer name";
    2.- When load multiple file, i'm unable to export more than one file per table.

    Please, can you help me?
    Sincerely
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,688
    edited October 2014
    Hello,

    The SPLIT_BY_LAYER script parameter is not supported when exporting to a spatial database. There is an active feature request to add this functionality to Global Mapper 16, but it has not been completed yet.

    Cheers,

    Bob
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited April 2015
    bmg_bob wrote: »
    Hello,

    The SPLIT_BY_LAYER script parameter is not supported when exporting to a spatial database. There is an active feature request to add this functionality to Global Mapper 16, but it has not been completed yet.

    Cheers,

    Bob

    Dear Global mapper developer,
    Where are you with SPLIT_BY_LAYER when export data to database? Please let me know!
    Thanks in advance!
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited May 2015
    What new about this command?
    Thanks in advance for your response!
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,688
    edited May 2015
    Hello,

    There has been no change in the status.

    Cheers,

    Bob
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    edited June 2015
    No hope to have it in the next release?
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,688
    edited June 2015
    Hello,

    It is currently on the list for Global Mapper 17, but that is not a guarantee that it will be implemented. Sometimes features get bumped to a later release due to resource constraints, etc. I have added a reference to this thread to the feature request so that we can post a notification when the status changes.

    Cheers,

    Bob
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    Hi bmb_bob,
    No status change to date?
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,688
    Sorry, no change in the status, and the SPLIT_BY_LAYER option will not be in Global Mapper 17.0.

    You can export a table for each layer by looping through your open layers (LAYER_LOOP_START/LAYER_LOOP_END) and exporting the current layer to a table. The Scripting Reference has an example under the documentation for LAYER_LOOP_START.
  • htuserhtuser Global Mapper User Posts: 35Trusted User
    Hi bmg_bob and all others,
    More than 3 years for #12759...SPLIT_BY_LAYER... Until now nothing. Please what happen!
  • bmg_bobbmg_bob Global Mapper Programmer Posts: 1,688
    htuser said:
    Hi bmg_bob and all others,
    More than 3 years for #12759...SPLIT_BY_LAYER... Until now nothing. Please what happen!
    Have you tried using the EXPORT_VECTOR parameters specified below to split your data by layer name?  This should work when exporting to a spatial database.
    SPLIT_BY_ATTR \
    FILENAME_ATTR_LIST="<Feature Layer Name>"
    Please note that when I tested this using a PostGIS database, I ran into a problem.  I fixed the problem, and the fix will be available in GM 18.1 daily builds dated Feb 24, 2017 or later.  Simply download the appropriate installer and run it to install the latest build.

    Cheers,
    Bob
Sign In or Register to comment.