blankblank blank

Archive for the 'shapefile' Category Page 2 of 9

MapTool Goes To Version 2– Elevations, Areas, And Distances In Google Maps

I’ve covered Zonums Software free online application MapTool before; the original version let you determine the elevation of a point in a Google Maps interface, as well as measuring the length of a multi-segment path or drawn polygon, but not much more. Zonums has recently updated this application to  MapTool 2, which adds some really nice new functions (most accessible by clicking on the Options link at top):

  • Create vertices by manually entering coordinates, in addition to previous option of clicking on map (use Input link at the top for this)
  • Continuous coordinate read-out in both latitude/longitude and UTM
  • Divide a drawn line into equal parts by automatically adding equally-spaced vertices, or add vertices with a user-defined spacing
  • Convert a drawn polygon into a polyline, and vice versa
  • Edit individual vertices in a line or polygon
  • Get a count of the total number of vertices in the drawn feature
  • Get an elevation profile for all the vertices on a line


  • Determine the extents (bounding box) for the drawn feature
  • Export the vertex coordinates as a text file
  • Export the line or polygon directly as a GPX, DXF or shapefile in latitude/longitude/WGS84, with the option to include vertex elevations

LandSerf – Google Earth And GPS Functions

In previous posts, I reviewed LandSerf’s raster terrain analysis functions and vector functions. Today I’ll wrap up with a short review of LandSerf’s Google Earth and GPS functions.

Google Earth: The most notable Google Earth functionality is the ability to export vector data, either imported or generated by the program, into KML vector files. So I can open a DEM, like the sample one of Mt. Rainier included with the program:


Generate a set of flow vectors for the DEM:


And then export the vector data as a KML file:


You could do something similar with a shapefile opened in LandSerf, but just be sure the shapefile is in NAD83 or WGS84. As I mention in the post on LandSerf vector functions, LandSerf has problems re-projecting from one datum to a significantly different second datum, and Google Earth data needs to be in WGS84 (NAD83 is almost the same). A search for “KML shapefile” on this blog will bring up a number of other programs that do a better job of converting shapefiles to KML, including preserving attribute data, which LandSerf doesn’t. But all of those are Windows-based; LandSerf runs on Macintosh and Linux, so it might be a useful option for those OSes.

Note: You should save vector data as a KML file; the KMZ file format is supposedly reserved for saving raster data as Google Earth image overlays, but I’ve been unsuccessful in getting that to work.

GPS: The list of useful GPS functions in LandSerf is a bit longer:

  • Convert loaded shapefiles or other vector data to GPX format (data must be in WGS84/NAD83 datum)
  • Load a GPX file as vector data, then save it in any of the vector formats LandSerf supports
  • Interface directly with a GPS. You’ll need to have the GPS connected to your computer and turned on before starting up LandSerf. To establish a connection to the GPS, use Configure=>GPS and scan for a connected unit. Once you do this, you can import waypoint data using the File=>Import from GPS function. While the dialog box gives you the option to import waypoints, tracks and routes:


I’ve had difficulty getting tracks to import successfully – the program just shuts down on me. This may just be an issue with my model GPS (Garmin 60Cx); f you have better luck, let me know. You can import the data in the default lat/long coordinate system. or re-project it on import to OSNG or UTM. Once there, you can export it in GPX, shapefile or other vector format.

  • You can also export point data (no lines or polygons) directly from LandSerf to a connected GPS as waypoints.

If you can get track data to import successfully from your GPS to LandSerf, which I couldn’t, there are several other functions that might prove useful:

  • On importing the data, you have the option of saving all the track data in spreadsheet format with position, elevation and time
  • As with other vector data, if you have a digital elevation model loaded in the program, you can get a elevation profile plot; see this previous LandSerf post for more info
  • If you have a GPS track that is broken into .segments because you lost the GPS signal, LandSerf has the ability to join all of the line segments into a single line, which you can then save as a GPX track file, using the Edit => Join vector lines function. AFAIK, it’s the only free program that can do this.

As with the Google Earth functions, there are other programs that can do most of this in Windows, but far fewer free options in Macintosh and Linux.

Convert/Reproject Shapefiles And KML Files To SVG Format With indiemapper

indiemapper is a promising-looking thematic mapping service that is supposed to come online shortly. But until then, they’ve released a free  online Flash application that lets you upload vector data (point, line or polygon) in KML or shapefile format, re-project it into one of 11 different projections …

  • Equirectangular
  • Mercator
  • Winkel Tripel
  • Robinson
  • Albers Equal Area Conic
  • Lambert Conformal Conic
  • Orthographic
  • Polyconic
  • Sinusoidal
  • Bonne
  • Cylindrical Equal Area

… and then export it as an Scalable Vector Graphic (SVG) file for use in programs like Adobe Illustrator or Inkscape. Shapefiles must be in geographic coordinates (latitude/longitude), WGS84; KML files are already in this format. Network KML files are acceptable. Add a file to the display, or choose one or more of their sample datasets:


You can load multiple datasets into the display, move their draw order, and turn them on and off  by clicking on the “eye” icon:


The graticule grid can be turned on and off, and spacing set to automatic or manual.

Select the projection using the “Project” button at upper-right:


You’ll get info about the projection, including its pluses and minuses. Here’s Mercator (a screen capture, not SVG):


And Albers Equal Area Conic:


With the center latitude/longitude of view adjustable. Once done, click on the “Export” button at upper right to convert the vector data to SVG format, and download it to your computer for use in vector editing software, or for viewing in a compatible browser like Firefox.

There are limitations for now. There’s no control over layer colors, and no thematic coloring based on the attributes of the vector files. It looks like the full indiemapper application will have those, and the screenshots make it look interesting, but it’s not clear yet whether that full online app will have a free version. Stay tuned.

Via the thematic mapping blog.

LandSerf – Vector Functions

In a previous post, I gave a random overview of LandSerf’s strong terrain analysis functionality. But it  has some some useful vector functions as well, some derived from or related to raster elevation data, others more general. I won’t talk about the general vector data creation functions here; they’re perfectly fine, but lots of free GIS program can do that; instead, I’ll just highlight a few of the more distinctive vector functions that aren’t as common. Note: Save the derived vector data if you want to keep it; LandSerf doesn’t save created, modified or derived datasets automatically.

Continue reading ‘LandSerf – Vector Functions’

Convert TIGER Census Shapefiles (And General Shapefiles As Well) Into Thematic Google Earth KML Files

Bruce Ralston of the University of Tennessee has previously released several US Census TIGER data tools that I’ve posted about in the past. TGR2SHP converts TIGER files into shapefile format, while TGR2KML converts TIGER polygon files (like legislative districts and county subdivisions) into basic KML files for viewing in Google Earth. Both of these tools only work with the older pre-2007 TIGER format, which is no longer in use; the Census Bureau now issues all this TIGER data in standard shapefile format. But Bruce Ralston has just released a new tool called AFF Mapper that goes a step beyond his previous ones: it can convert TIGER shapefile data into KML format, link it to tabular American Fact Finder data (AFF) from the US Census, and plot this census data thematically. But unlike the previous TIGER tools, this one is a general-purpose one; it can convert any shapefile – point, line or polygon – into a thematic or unique value KML file, with the option of using thematic data from a linked external table. The only limitation is that the shapefile must be in geographic coordinates (lat/long), WGS84 datum, Google Earth’s native coordinate system.

I won’t go through the process with Census data; there’s an excellent PDF manual that describes the process of creating maps like this one (from the manual):

Continue reading ‘Convert TIGER Census Shapefiles (And General Shapefiles As Well) Into Thematic Google Earth KML Files’

Assigning Attributes From A Polygon Shapefile To Another Shapefile

Here’s a recap of yesterday’s request from TD:

Wondering if you know of an easy way to create centroids (points) from polygons – I am using MapWindow and various other free tools. What I am ultimately trying to do is assign attribute data (parcel #) to a polygon shapefile representing buildings.  In other words, for each building polygon I want to assign it the correct parcel #.

Yesterday’s post went through the first part of this process, converting the building polygon shapefile  into a centroids (approximate building geometric centers) point shapefile, carrying over the building shapefile attributes to the corresponding centroid points. Now I need to assign attribute data from the parcel polygon shapefile to the centroids.

Continue reading ‘Assigning Attributes From A Polygon Shapefile To Another Shapefile’

Centroids From A Polygon Shapefile With SAGA

TD asks:

Wondering if you know of an easy way to create centroids (points) from polygons – I am using MapWindow and various other free tools. What I am ultimately trying to do is assign attribute data (parcel #) to a polygon shapefile representing buildings.  In other words, for each building polygon I want to assign it the correct parcel #.

Yes, you can do both tasks with free GIS software. Today, I’ll do the centroids, tomorrow the assignment of attribute data from one shapefile to another. Based on your description, you probably don’t need to create a centroid file, but it provides a convenient excuse for me to go through the functionality of a program full of great GIS tools. While I find its data display interface a little clumsy for regular use, the freeware GIS SAGA has an enormous list of useful functions, many of which are non-existent or hard to find in other free GIS programs. The basic process for using any of these functions is pretty much the same, so the following procedure can be used as a general guideline for using any of the function modules.

Continue reading ‘Centroids From A Polygon Shapefile With SAGA’

Fixing Corrupt Shapefiles

I’ve posted before on two free Windows apps for fixing corrupt shapefiles, Shape Checker and Shapefile Repair Tool. PerryGeo describes a third option: use the command-line tool ogr2ogr to re-write the shapefile under a new name, hopefully with the corrupt parts fixed. From that post, and from its comments, you would use the following command operation:

ogr2ogr -f “ESRI Shapefile” –skipfailures shiny_new_clean_dataset.shp corrupted_dataset.shp corrupted_dataset

ogr2ogr is available as part of the installable FWTools package, but can also be installed using the OSGeo4W program covered earlier covered earlier on this blog.

Don’t like command-line operations? The free ogr2ogr GUI ogr2gui can do the same operation, with a little extra effort:

1. Select the corrupt shapefile as the source, and set the Target type as “Shapefile”:

3-31-2009-7.32.19 PM

2. Add in the “-skipfailures” switch by typing in the line command box below:

3-31-2009-7.35.20 PM

3. Click “Execute”, and you’re done. Unfortunately, I didn’t have a corrupt shapefile to test it on, but worked fine on a good shapefile. If you’ve got a corrupt shapefile, let me know if it worked for you.

Keep in mind that this isn’t a guaranteed fix. PerryGeo’s post quotes a 90% success rate, and the comments to the post note that sometimes in a corrupt shapefile, the fixed file may not have the attributes correctly linked to the matching shapes. YMMV.