cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) Tips & Tricks for cGPSmapper This document focuses on the ESRI shapefile capable versions of cGPSmapper. It is not intended to be a cGPSmapper “A … Z” guide. This document is a work in progress. If you have a tip that you’d like to share please put it on the newsgroup and ask for it to be added to Tips & Tricks. As several people may make the same or similar suggestions the document will not acknowledge individual contributors. 533575104 Page 1 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) Overview A) This Tips & Tricks document is intended to assist you with the process involved in using the ESRI shapefile capable versions of cGPSmapper. B) This may seem more difficult at first than other methods (such as using GPSmapedit) if you only have a couple of tiles to make but if you have a lot of data it will definitely be both easier & faster to use the shapefile method. C) Most of the basic concepts remain unchanged but with the shapefile capable versions you go direct from shapefiles to IMG file(s). GPSmapEdit is not used at all except it is very useful for a quick review of the img output prior to creating the preview files. D) A high level view of the process is: i) Prepare your base data in three of four large master shapefiles ii) Use intersect to create individual shapefiles, e.g. one line shapefile for each map tile. iii) Run cGPSmapper with a batch file to create the detail IMG files iv) Run cGPSmapper with a batch file to create the preview files General Requirements & Procedures 1) You will need some competence with Arcview but there are plenty of Arcview tutorials on the net. The sketchy Arcview notes below may help but Arcview help is outside the scope of this document. (We say Arcview but there are alternative programs to create & manipulate shapefiles.) 2) Using Arcview, prepare your master polygon, line & point themes. Pay attention to: a) If you start with third party shapefiles the chances are they have many extraneous fields. Eliminate these if you are ABSOLUTELY sure you will never need them as they do slow you down, BUT, they may be very difficult to add back later on. b) You need a numeric field that is used to store the type data (1 = principal highways, 2 = major roads etc) and a string field that is used for the name of the poly/line/point i) Create these in the master shapefile so that it will be consistent in all individual files. 3) When you are completely happy that your master files have the appropriate fields including those for Name & Type you then divide your master shapefiles into individual shapefiles, one for each eventual map tile. (When you do this DO NOT discard your master file as you will go back to it whenever you need to edit your base data. ) 533575104 Page 2 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) a) One way to divide the data is using the batch overlay function in the Arcview extension Xtools. Undoubtedly there are others. 4) You should end up with a structure like this: a) Polys_1.shp The polygon theme for map tile #1 b) Ponts_1.shp The point theme for map tile #1 c) Lines_1.shp The line theme for map tile #1 d) Misc_1.shp Additional line theme for map tile #1 (Optional) e) Pt_1.shp Additional point them for map tile#1 (Optional) f) Polys_2.shp The polygon theme for map tile #2 g) Ponts_2.shp The point theme for map tile #2 h) Lines_2.shp The line theme for map tile #2 i) Misc_2.shp Additional line theme for map tile #2 (Optional) j) Pt_2.shp Additional point them for map tile#2 (Optional) ........ k) Polys_n.shp The polygon theme for map tile #n l) Ponts_n.shp The point theme for map tile #n m) Lines_n.shp The line theme for map tile #n n) Misc_n.shp Additional line theme for map tile #n (Optional) o) Pt_n.shp Additional point them for map tile#n (Optional) ADDITIONAL NOTES: i) Each theme can include many features, for instance the lines theme could include several class of roads, political boundaries etc. However, sometimes it is more convenient to separate them such as for instance one line theme for roads and a second for administrative boundaries, a third for rivers etc. ii) Some themes may have only polys but no points and only a portion of the tiles may have a misc theme etc. This will not cause any problems 5) The ESRI capable version of cGPSmapper can be used in batch mode, using the following syntax: cGPSmapper ac default.mp -d 12345678 “Easy tile name” NOTES: i) To see the full range of cGPSmapper options run cGPSmapper without any of the parameters. 533575104 Page 3 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) ii) In the example above the map tile number is 12345678 and the easy map name is Easy tile name. Note the use of the “quote marks” around the name. These are optional IF there are no spaces in the tile name. iii) The text file default.mp specifies the options, dictionary settings and names of the shapefiles etc. (1) Each section of Default.mp has a line such as “Name=templine” which specifies the name of the shapefile to be used in that section. Note that you must not use the extension portion of the shapefile name. (2) Each section has a line to specify which field carries the name of the element, e.g. “LabelField=Name” (3) Each section has a line to specify which field designates the type of line / point / poly etc, e.g. “TypeField=type” (4) The Dictionary section is unchanged but in this example some comment lines have been added for easier reading. iv) The sample Default.mp looks like this: Default.mp [IMG ID] PreProcess=F TreSize=2000 ;RgnLimit=500 Levels=5 Level0=24 Level1=21 Level2=19 Level3=16 Level4=14 Zoom0=0 Zoom1=1 Zoom2=3 Zoom3=4 Zoom4=6 [END-IMG ID] ;=========== DICTIONARY ; RGN 20 = points ; RGN 40 = lines ; RGN 80 = polys ======================== [DICTIONARY] ; NOTE ; If there is no LevelxRGNn= statement for a given level then it ; defaults to all “ones”. Hence you could have had the same impact ; by adding a Level0RGNn=111111111111111111111111 line with to ; each of the three dictionary sections below. 533575104 Page 4 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) ; Type 10 20 30 40 ; | | | | ;-----------123456789 123456789 123456789 123456789 Level1RGN20=00010101010000000000000000000000000000000000 Level2RGN20=00010101000000000000000000000000000000000000 Level3RGN20=00010100000000000000000000000000000000000000 Level4RGN20=00010000010000000000000000000000000000000000 ; Level5RGN20=00010000000000000000000000000000000000000000 ; Type 10 20 30 40 ; | | | | ;-----------123456789 123456789 123456789 123456789 Level1RGN40=11111000000000000000000000010000000000000000 Level2RGN40=11111000000000000000000000010000000000000000 Level3RGN40=11110000000000000000000000010000000000000000 Level4RGN40=11100000000000000000000000010000000000000000 ; Level5RGN40=11000000000000000000000000010000000000000000 ; Type 10 20 30 40 ; | | | | ;-----------123456789 123456789 123456789 123456789 Level1RGN80=00000000000000000000000000000000000000010000 Level2RGN80=00000000000000000000000000000000000000010000 Level3RGN80=00000000000000000000000000000000000000010000 Level4RGN80=00000000000000000000000000000000000000010000 ;Level5RGN80=00000000000000000000000000000000000000010000 ; All polys filtered out except Sea (Poly type 40) [END-DICTIONARY] ;============= LINES ========================== [SHP] Name=templine ;Type 64 for lines, 16-POI, 32-points and 128-regions Type=64 LabelField=Name TypeField=Class Level=0 EndLevel=5 [END-SHP] ;============= [SHP] Name=tempstat Type=64 LabelField=Name TypeField=Class Level=0 EndLevel=5 [END-SHP] LINES #2 ;============= POLYS [SHP] Name=temppoly Type=128 ;LabelField=Name ;DefaultType=40 TypeField=type 533575104 ======================= ========================== Page 5 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) Level=0 EndLevel=5 [END-SHP] ;========== POPULATION CENTRES (POINTS) [SHP] Name=temppopn Type=32 LabelField=Name TypeField=Locality Level=0 EndLevel=5 [END-SHP] ======= ;============= MISC POINTS ==================== [SHP] Name=tempmisc Type=32 LabelField=Name TypeField=Locality Level=0 EndLevel=5 [END-SHP] ; *********************************** 6) The ESRI capable version is very well setup for batch operation. That is, you control it with a very simple batch file. a) If you are new to batch files take a look at http://www.computerhope.com/batch.htm Note that some batch commands are specific to the flavour of DOS. The batch files included here run under Win XP, others may vary slightly. b) There are two basic alternatives for creating lots of detail IMG files, i.e. i) The traditional way is to create a folder for each map tile and then use identical names for the shape files, i.e. all point themes will have the same name but they will be in separate folders. This should not be too difficult. ii) The method preferred method by the author is: (1) Use the name convention as in point four above, that is four or five characters common to all point themes etc then a number at the end to distinguish them. (2) The master batch file “calls” a second batch file (like a sub-routine) which renames the files in turn and returns control to the master batch file which runs cGPSmapper. Sounds complex but in reality very straight forward. Sample batch files are: Batch_create_img.bat ECHO OFF ECHO Parameters file is called default.mp ECHO Question - must it be ".mp" 533575104 Page 6 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) ECHO Simple Excel spread sheet used to generate the batch lines ECHO My IMG file numbers are generated from the Map names ECHO Need to fill in the easy name map name in my Excel spreadsheet. ECHO Tile index names are valuable when editing/looking for problems etc ECHO REM Note that in the next line there is a space between “copy_files.bat” and “_1” and the same in all subsequent lines. Call copy_files.bat _1 cGPSmapper ac default.mp DEL TEMP*.* Call copy_files.bat _2 cGPSmapper ac default.mp DEL TEMP*.* Call copy_files.bat _3 cGPSmapper ac default.mp DEL TEMP*.* . . . . . . . Call copy_files.bat n cGPSmapper ac default.mp DEL TEMP*.* -d 88005111 “Cape York 1” -d 88003131 “Lake Mackay 2” -d 88002131 “Telfer 3” -d 88009999 ”Last tile 99” Copy_files.bat COPY COPY COPY COPY COPY COPY ECHO polys%1.* points%1.* lines%1.* popn%1.* misc%1.* state%1.* temppoly.* temppont.* templine.* temppopn.* tempmisc.* tempstat.* Have now copied shapefile %1 to TEMPxxxx.* iii) NOTES: (1) The master batch file “passes” the map tile reference to the copy_files.bat as a variable so that it only copys one set of shapefiles in each pass. (2) In the first line the variable is “_1” and the %1 in copy_files.bat is replaced by “_1” on the first pass and next time it is ”_2” etc. You don’t have to understand it, because it works!! (3) An Excel spreadsheet is an easy way to create and maintain the master batch file. It will take a little time first time around but you will use it very often. A spreadsheet can include formulae to create map tile numbers, reference the original tile numbers to the 8 digit img name and the corresponding easy tile name etc. Very quick & easy using simple text arithmetic and a few other functions. 533575104 Page 7 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) When you make a change, copy the output column in the spreadsheet straight into the (batch) text file. You’ll want to understand some Excel functions such as: (i) The ampersand (&) for joining two text strings (ii) The formula =left(a,b) and =right (a,b) for selecting portions of a string (iii) If statements, sometimes nesting them makes it quicker. (iv) Vlookup is also very useful. 7) The preview files are created in the traditional way as if you had manually created your detail IMG files. To quickly recap on that process: a) Create a simple batch file: Create_preview.bat c:\gps-mapper\cGPSmapper pv -l C:\MapSet\Finished_IMG\Mapset_pv.txt > preview.log REM C:\MapSet\Finished_IMG\ is the full path to the completed detail IMG files. b) Mapset_pv.txt is the file that provides the settings for preview file creation. No change in this area. c) My Mapset_pv.txt file looks like: ; Sample file accepted by cGPSmapper to create new map data-set [Map] FileName=Mapset ; Above determines name of preview img & tdb files MapVersion=100 ProductCode=6600 Levels=2 Level0=14 Level1=12 Zoom0=5 Zoom1=6 ; ============================== MapsourceName=Mapset MapSetName=Mapset CDSetName=Mapset [End-Map] [Files] img=C:\Mapset\Finished_IMG\66001131.img img=C:\Mapset\Finished_IMG\66001141.img img=C:\Mapset\Finished_IMG\66001151.img img=C:\Mapset\Finished_IMG\66002131.img img=C:\Mapset\Finished_IMG\66002141.img 533575104 Page 8 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) img=C:\Mapset\Finished_IMG\66004131.img img=C:\Mapset\Finished_IMG\66004141.img img=C:\Mapset\Finished_IMG\66004151.img img=C:\Mapset\Finished_IMG\66004161.img img=C:\Mapset\Finished_IMG\66005111.img img=C:\Mapset\Finished_IMG\66005121.img . . . . . img=C:\Mapset\Finished_IMG\66005131.img [END-Files] Arcview Extensions You will undoubtedly need a few Arcview extensions. If you don’t already have your own favourites try these: 1) Xtools. Perhaps the most used extension. Useful for all sorts of file manipulation and its batch capability is a true winner when you need to divide a large shapefile into individual shapefiles for map tiles. (We suggest Intersect) Examples where we use Xtools: i) Intersecting a master shapefile to create lots of smaller shapefiles ii) Merging themes iii) Renaming themes iv) Convert graphics to shapes & vice versa v) Convert polygons to polylines vi) Managing shapefiles (renaming, deleting, copying etc) 2) Edit Tools Also useful for various purposes but in particular: i) Splitting lines ii) Manipulating donuts (islands etc) 3) AV Tools i) Splitting polygons ii) Etc 4) Memo Tools i) Create theme of the outer extents of another theme (MemoTheme/ Theme Extent To Polygon shape) ii) Split a polygon theme into individual shapefiles, one file for each record. (You can use this to create shape files for individual map tiles, i.e. (1) Create a polygon theme that has a record for each eventual map tile (2) Use Memo Tools to split this index shapefile into n shapefiles where n is the number of map tiles that you want. 533575104 Page 9 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) (a) You can split an existing polygon with a polyline. To keep your polylines square, draw rectangles as graphics, convert to shapefiles, convert polygons to polylines and delete unwanted lines. (3) Use the batch capability of Xtools to intersect the master shapefiles and create individual shapefiles for each tile 5) Geoprocessing tools i) To join two or more polys into one (dissolve lines between them) 6) MemoTools extension i) MemoTheme/ Theme Extent To Polygon shape General cGPSmapper Tips 1) If you omit a Dictionary line it is by default filled with 1. Therefore Level1RGN40=11111000000 Level2RGN40=11111000000 Level3RGN40=11110000000 is equivalent to Level0RGN40=1111111111111111111111111111111111111111111111111111111 etc Level1RGN40=11111000000000000000000000000000000000000000000 Level2RGN40=11111000000000000000000000000000000000000000000 Level3RGN40=11110000000000000000000000000000000000000000000 2) Keys LevelX (from [IMG ID]) defines BOTH : a) data resolution b) visibility of the data for different zoom ranges 3) The number of levels in your detail maps is defined in your [IMG ID] section: [IMG ID] PreProcess=F TreSize=2000 ;RgnLimit=500 Levels=5 Level0=24 Level1=21 Level2=19 Level3=16 Level4=14 Zoom0=0 Zoom1=1 Zoom2=3 Zoom3=4 Zoom4=6 [END-IMG ID] and the content is filtered with the Dictionary settings, e.g. ; Type 10 20 30 40 ; | | | | ;-----------123456789 123456789 123456789 123456789 Level1RGN40=11111000000000000000000000010000000000000000 533575104 Page 10 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) Level2RGN40=11110000000000000000000000010000000000000000 Level3RGN40=11100000000000000000000000010000000000000000 Level4RGN40=11100000000000000000000000010000000000000000 a) The Level 4 dictionary line adds no value as the last level will always be empty, regardless of the Dictionary settings. (Open one of your completed IMG in GPSmapedit and check the statistics for each level.) b) The preview file will take on the detail that is included in the most detailed level, i.e. Level 3 in this example. c) Adding an additional Dictionary statement, e.g. Level5RGN40=1111111111 Will make no impact at all d) The levels must be defined in declining order AND there must be a Zoom defined for each level. If either of these rules is not observed you’ll get an error message along the lines of: default.mp(18) : Error E021: Grid definition for layers must be descending (check LevelX keys in [IMG ID]) 4) “When cGPSMApper runs, the x000 or so polygons I started with are split into 60k =very small= squares. Which take a long time to compile…..” - This is a typical TreSize related issue - If you make larger value for TreSize - then you got larger objects, smaller TreSize - smaller objects. - Play with this value in range 5000 - 500 to find best value. 5) Re finished IMG map sizes a) Limit of 1MB is good ONLY if we are talking about quite old devices – like GPS III+ or GPS12Map b) If we talk about modern receivers - sizes around 2Mb - 3Mb seems reasonable but remember - not the size is most important but performance. 6) Re name of the input parameters file for detail IMG files. - Called Default.mp in my example above - When you are using 'ac' command - you are not obligated to use .mp extenstion (mp extension is required when there is no 'ac' command) 7) “I receive the following error when trying to open my newly created map in mapsource v4 v4.09” “There is a problem with this GARMIN application…….” Typically this is a registry problem. Duplicating a file name in the preview parameters file (Mapset_pv.txt in my example above) will always result in a crash. To fix: - Correct Mapset_pv.txt - If neccesary reedo registry entries 8) General idea of the registry : 533575104 Page 11 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) a) LOC is pointing to the DIRECTORY where you store DETAIL IMG FILE (or FILES) - the real maps b) BMAP is pointing to the preview IMG file - the one created after 'pv' or 'pvx' command c) TDB is pointing to the TDB file IF MapSource is unable to start (you made something wrong in the file) - you can either re-edit the reg file and again add it to registry (since the names of keys are the same - it will replace old values) - OR start 'regedit' ( Start->Run and type 'regedit' ) go to path HKEY_LOCAL_MACHINE\SOFTWARE\Garmin\MapSource\Products\66 and fix your errors or even delete whole branch and start again. Other Tips 1) This will probably sound strange if you didn’t grow up with the DOS command line but besides the three or four major batch operations (create IMG files & create preview files) you will find it very useful to create several small batch files for all sorts of repetitive operations. These might include: a) Creating directory listings to get a list of shapefile names, e.g. DIR *.dbf /b > directory.txt b) Unzipping a sub-set of files from a group of storage zip files, e.g. unzip.exe *.zip *f_r.* c) Deleting files of a certain type, e.g. DEL *f_r.* 2) Excel is very useful for creating batch files. Using the text arithmetic character (&) you can very quickly create a long batch file and vastly reduce the potential for typographical errors. 3) Be disciplined about your folder & file names, where you keep the various files etc. Much easier in the long run. 4) Back up your shapefiles regularly . . . you will make mistakes and corrupt files occasionly. 5) Make notes about your process. Takes a little time but very useful if you get back into the project after a few weeks away. 6) Delete any land background elements from your shapefiles or use the Dictionary to filter them out. For instance, the only background polygons that you want are those that designate ocean. Islands are only holes in the sea and large land masses don’t need to be individually defined either. 7) Use Excel if you need to enter large amounts of numbers to designate line type or road names etc. Use nested IF statements to create a unique number from a line description such as Highway, residential street etc. 533575104 Page 12 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) ====================================================== Other Arcview Tips 1) To simplify themes with many islands. . . . . . . a) Copy frame theme twice b) Open one them and remove mainland & island records c) Using extension Edit Tools remove all donut holes from sea d) Open theme with all islands & remove excess records e) Save theme with only required islands f) Merge remaining island theme with sea theme g) Use Donut extension to remove donuts h) Save new sea theme i) Merge sea them with original mainland & required islands theme 2) To create theme of full extent . . . . a) Use MemoTools extension b) MemoTheme/ Theme Extent To Polygon shape 3) To split extent theme into individual shapefiles a) Use extension Memo Tools b) “MemoThm / Split Shapefile By Attribute” 4) To split lines at vertices etc . . . . a) Use extension Edit Tools b) Put lines in edit mode 5) To split one polygon to two or more for index theme a) Draw graphic rectangles to create polygons with lines at desired places “square” lines b) Use XT Tools to convert graphics to shapes c) Use XT Tools to convert polygons to polylines d) Use Edit Tools to split poly lines at vertices e) Delete unrequired lines f) Use extension AV Tools (“Poly split”) 6) To transfer features from one theme to another . . . . a) Use MemoTheme or Xtools ?? 7) To join polys into one a) Use extension Geoprocessing tools to join polys into one (dissolve) 533575104 Page 13 of 14 cGPSmapper (Shapefile capable version) Tips & Tricks Version 1.2 (12 Feb 2005) i) View / Geoprocessing ========== ==== 533575104 Page 14 of 14