Global Mapper Pro

Why is SHAPEFILE export not recognised?

George Chandeep Corea
George Chandeep Corea Global Mapper UserTrusted User
edited March 2014 in GM Script Language
I get the following

Importing file L:\Vector_Data\Administrative\Cultural\Native_Title\SHP\TRC_ILUA_Areas.shp...
Exporting vector data to file D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\TRC_ILUA_Areas.SHP...
ERROR: Unknown or missing SHAPE_TYPE value for EXPORT_VECTOR command.
Loop over files in directory completed.
Script processing COMPLETED [End Time: 03/05/14 11:54:58, Elapsed Time: 1.373 seconds]

From
GLOBAL_MAPPER_SCRIPT VERSION=1.00 
SET_LOG_FILE FILENAME="D:\Scratch\gms\my_script.log"
DIR_LOOP_START DIRECTORY=L:\Vector_Data\Administrative\Cultural\Native_Title\SHP FILENAME_MASKS="*.SHP"
IMPORT FILENAME="%FNAME_W_DIR%" 
EXPORT_VECTOR FILENAME="D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\%FNAME_WO_EXT%.SHP" TYPE=SHAPEFILE
DIR_LOOP_END

What's wrong? it works fine with KML for example.

Comments

  • global_mapper
    global_mapper Administrator
    edited March 2014
    The Shapefile format can only export areas, lines, or points to a file, so you have to specify what type of Shape to export, like SHAPE_TYPE=AREA, SHAPE_TYPE=LINES, or SHAPE_TYPE=POINTS.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • George Chandeep Corea
    George Chandeep Corea Global Mapper User Trusted User
    edited March 2014
    Thanks Mike, what happens when it's in a automated routine where the data can be one of the three? Is there a function to automatically choose?
  • global_mapper
    global_mapper Administrator
    edited March 2014
    I've updated the EXPORT_VECTOR command so that if no SHAPE_TYPE is provided for a Shapefile export but only one feature group (areas, lines, or points/Lidar) is loaded, the SHAPE_TYPE is set automatically. 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
  • George Chandeep Corea
    George Chandeep Corea Global Mapper User Trusted User
    edited March 2014
    Thanks but I am now getting
    Starting loop over all files in directory...
    Importing file L:\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTDA_Register_TRC.shp...
    Exporting vector data to D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTDA_Register_TRC.SHP"...
    WARNING: Unable to open D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTDA_Register_TRC.SHP" for export.
    Importing file L:\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTD_Register_TRC.shp...
    Exporting vector data to D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTD_Register_TRC.SHP"...
    WARNING: Unable to open D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTD_Register_TRC.SHP" for export.
    Importing file L:\Vector_Data\Administrative\Cultural\Native_Title\SHP\TRC_ILUA_Areas.shp...
    Exporting vector data to D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\TRC_ILUA_Areas.SHP"...
    WARNING: Unable to open D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\TRC_ILUA_Areas.SHP" for export.
    Loop over files in directory completed.
    [/QUOTE]
  • Mykle
    Mykle Global Mapper User Trusted User
    edited March 2014
    Curious ...
    Why is a " the last character of each of the export filenames, but the entire pathname is not quoted?
    And, (probably an artifact of the log file) why is there a space in character position 51 of every filename?
  • George Chandeep Corea
    George Chandeep Corea Global Mapper User Trusted User
    edited March 2014
    Thanks Mykle - it was the " at the end of the export command that's an artefact from my python script that creates the GMS file. Once I corrected this it worked fine.
    Starting loop over all files in directory...
    Importing file L:\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTDA_Register_TRC.shp...
    Exporting vector data to D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTDA_Register_TRC.SHP...
    Importing file L:\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTD_Register_TRC.shp...
    Exporting vector data to D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\NTD_Register_TRC.SHP...
    Importing file L:\Vector_Data\Administrative\Cultural\Native_Title\SHP\TRC_ILUA_Areas.shp...
    Exporting vector data to D:\scratch\gms\export\Vector_Data\Administrative\Cultural\Native_Title\SHP\TRC_ILUA_Areas.SHP...
    Loop over files in directory completed.


    ONE OTHER QUESTION - does GMS also search/process subdirectories?
  • George Chandeep Corea
    George Chandeep Corea Global Mapper User Trusted User
    edited March 2014
    Just tried on some other files. I am still getting the Error on some files.
    GLOBAL_MAPPER_SCRIPT VERSION=1.00 
    SET_LOG_FILE FILENAME="D:\Scratch\gms\MSC_DataExtract.log"
    DIR_LOOP_START DIRECTORY=L:\Vector_Data\Relief\Contours\1_Metre\SHP\Lidar_2011_Tiles FILENAME_MASKS="*.SHP"
    IMPORT FILENAME="%FNAME_W_DIR%" 
    EXPORT_VECTOR FILENAME=D:\scratch\gms\export\Vector_Data\Relief\Contours\1_Metre\SHP\Lidar_2011_Tiles\%FNAME_WO_EXT%.SHP TYPE=SHAPEFILE
    DIR_LOOP_END
    
    
    

    Results in
    Starting loop over all files in directory...
    Importing file L:\Vector_Data\Relief\Contours\1_Metre\SHP\Lidar_2011_Tiles\1m_Contour_Index.shp...
    Exporting vector data to D:\scratch\gms\export\Vector_Data\Relief\Contours\1_Metre\SHP\Lidar_2011_Tiles\1m_Contour_Index.SHP...
    Importing file L:\Vector_Data\Relief\Contours\1_Metre\SHP\Lidar_2011_Tiles\Lidar_Biboohra_Koah.shp...
    Exporting vector data to D:\scratch\gms\export\Vector_Data\Relief\Contours\1_Metre\SHP\Lidar_2011_Tiles\Lidar_Biboohra_Koah.SHP...
    ERROR: Unknown or missing SHAPE_TYPE value for EXPORT_VECTOR command.
    Loop over files in directory completed.
    Capture.JPG
    Input Directory Looks like



    Output Directory looks likeCapture.JPG
  • global_mapper
    global_mapper Administrator
    edited March 2014
    I think you need an UNLOAD_ALL at the end of your loop otherwise you are just accumulating files as you load them all. Once you have a mix of areas, lines, and points the SHAPE_TYPE would be needed.

    You can recurse by adding RECURSE_DIR=YES to the DIR_LOOP_START command.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • George Chandeep Corea
    George Chandeep Corea Global Mapper User Trusted User
    edited March 2014
    Thanks. That works now. Is there anyway to get it to not process any files that have no features within the given clip area? As it is run on a large collection of files, I don't want it to waste time processing and creating directories for files that aren't within the AOI/clip area.
  • George Chandeep Corea
    George Chandeep Corea Global Mapper User Trusted User
    edited March 2014
    I just tested the output and it doesn't seem to have retained the projection or be cut to the AOI. For ex. The output should have only included the files above the red line in the example below.
    Capture.JPG

    The code was
    GLOBAL_MAPPER_SCRIPT VERSION=1.00 
    SET_LOG_FILE FILENAME="D:\Scratch\gms\MSC_DataExtract.log"
    DIR_LOOP_START DIRECTORY=L:\Vector_Data\Relief\Contours\1_Metre\SHP\Lidar_2011_Tiles RECURSE_DIR=YES FILENAME_MASKS="*.SHP"
    IMPORT FILENAME="%FNAME_W_DIR%" 
    EXPORT_VECTOR FILENAME=D:\scratch\gms\export\Vector_Data\Relief\Contours\1_Metre\SHP\Lidar_2011_Tiles\%FNAME_WO_EXT%.SHP TYPE=SHAPEFILE
    UNLOAD_ALL 
    DIR_LOOP_END
    
  • George Chandeep Corea
    George Chandeep Corea Global Mapper User Trusted User
    edited March 2014
    My mistake, the POLYGON_CROP_FILE=P:\2014\001_TP_Deamalgamation_Production\Working\base_data\MSC_Boundary_Locgovbdy_dcdb.shp
    hadn't been added by the python script.

    The other issue is that while the subdirectories are being read, the output folder structure doesn't include the subdirectory name. Is it possible to include this?
  • global_mapper
    global_mapper Administrator
    edited March 2014
    If all of the files are one directory deep then make your EXPORT_VECTOR command add the %PARENT_DIR% in the filename, like the following:

    EXPORT_VECTOR FILENAME=D:\scratch\gms\export\Vector_Data\Relief\Contours\1_Metre\SHP\Lidar_2011_Tiles\%PARENT_DIR%\%FNAME_WO_EXT%.SHP TYPE=SHAPEFILE

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • George Chandeep Corea
    George Chandeep Corea Global Mapper User Trusted User
    edited March 2014
    Cool. What would happen if some have only one level and others have more levels or no levels?
  • global_mapper
    global_mapper Administrator
    edited March 2014
    I'm going to add support for a new variable (%RECURSE_FOLDER%) so that you can get the recursed portion of the folder name inside a loop to use when building a new filename. I'll let you know when a build with that is ready.

    Thanks,

    Mike
    Global Mapper Guru
    geohelp@bluemarblegeo.com
    Blue Marble Geographics for Coordinate Conversion, Image Reprojection and Vector Translation
  • global_mapper
    global_mapper Administrator
    edited March 2014
    I've completed adding support for adding %RECURSE_FOLDER% inside a directory loop to get the sub-folders. 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
Sign In or Register to comment.