The ArcPad Team Blog

Unofficial stuff from the team behind the World's leading mobile GIS platform

Tuesday, August 03, 2010

Create Local Map Tiles

Users often have lots of data that take out to the field purely for visual representation, however with that can come performance issues on mobile devices – as lots of features all on top of each other with labeling and complex symbology can take along time to draw (even on a pc). People do this though because: If you can’t see where you are how can you believe the GPS is in the correct location and if you have no GPS signal how else do you navigate around your project area without the functional base map?

It has often been advertised that you need your data to be as accurate as possible to determine where you are, but all data needs to be (and is) generalized based on the scale that you are viewing so that your PC can draw as fast as possible. As the diagram shows, when looking at a project working on Main land Australia, why should I even bother drawing the islands that are around it – sorry Tasmania (we still love you)! What you’ll also notice is that the boundary is a lot smoother as well. At this scale the map doesn’t need to draw 15,000,000 + vertices why not just a couple of thousand. These techniques are not new but I want to highlight them along with considering data as “project data”. It is of course a great idea to have a central repository for storage and management of data, but why not take a copy/version and process it so that it works the best it can for you!



Another method of generalizing vector data is building image tiles (caches) of them – sound familiar? This is the basic theory of ArcGIS Online, Bing and Google. They all edit vector data but they are now publishing image (rasters) tiles that draw much fasterer. It has always been faster to draw rasters in ArcPad but has seldom been taken up. Sound like a good idea? Now if you have ArcGIS Server you can take care of this out of the box with the geoprocessing tools for Server – see our other blog entry Basemap Image Tiles for ArcPad 10. Although if you don’t have ArcGIS Server but you do have ArcGIS 10 for the desktop then perhaps I can help with another approach.



As I mentioned before we believe in using project based data – where all data is manipulated whether it be labeling, scale references, generalization, query definitions, symbology and even Areas of interest. Please remember, your maps may look great in the office but are they functional in the field In the ArcPad Team R&D department (we’re allowed to say it’s an official department because we have a lab coat in the office) we used the new ArcGIS 10 ArcPy module to develop a Python script sample that exports the data frame you have set up in ArcMap to a series of TIFF tiles rendered at the scale you nominate using the tool. Phew, that was a mouthful! So in summary, it squishes all your vector layers together and cuts the map up in to little pieces so they’re nice and fast to use in ArcPad.

You could actually perform this function without the tool. In your map, simply set the scale to your desired working scale and then use the Export Map function under File > Export Map. Give the image a File name and in the options set the to write GeoTIFF tags and write the world file. Then loop through this until you have exported your map. I did this for a city area of about 8 km2 and it took about an hour to create 56 tiles. Even If you did it this way you have a great set of base tiles, and if you have any updates to your base vectors, you would only have to export the area that was affected.



For those that don’t want to do this approach manually I have scripted, basically exactly those steps into a geoprocessing tool. The tool will prompt you with a dialog box for your working scale and the folder location that you want to store the images. The script is only a SAMPLE of what you can do, if you are up for a challenge take the code further fix my mistakes! To get the download – CLICK HERE. Please read the instructions!!!



A couple of hints:
  • Being a sample this only work for data frames in ArcMap that are set to Meters (there’s the first challenge for you to fix).
  • If you hard code scale and folder location and the Map Document name into a script you could run this as a scheduled task so every day you could have updated tiles.
  • You may have to edit the Tools source and point it to the location where you extracted the files from the zip file.
  • You can use this on any data in your data frame, even Cloud services such as ArcGIS Online, Bing or OpenStreetMap! Whatever data you have sitting on top of these base maps will be combined.
  • TIFF is the best version for the ArcPad to render but you can edit the script to change the format that you want to use (remember, we suggest TIFF)
  • You could reload the tiles into ArcMap, set reference scales and use the data manager to send them to ArcPad then you have scale dependent rendering (Hey, maybe you can add that to the script as well!)

Once the images are created you will be able to load them straight into ArcPad. So get mapping and have fun!