blankblank blank


Archive Page 39 of 106



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’




List Of Towns And Cities In A Country With Coordinates And Elevation

In a previous post’s comments section, someone asks if there’s “a way to filter for US cities (or world cities for that matter) that are between 3000 feet and 4000 feet elevation”. In order to do that, you need the data, and oddly enough there’s a specialized little application that can retrieve that data for world cities. GeoMaker (scroll down for the download link) lets you select from a list of world countries, then queries the NIMA (National Imaging and Mapping Agency) online database for the following:

  • City/town name
  • Geographical coordinates (latitude/longitude)
  • Region/State (if available)
  • Elevation above sea level (in meters)

You can also download a text file with NIMA gazetteer data as well for a particular country, but it includes all geographic features, not just cities, and can be enormous in size.

Output is in text format, in either “|”, comma or tab delimited formats, as specified in the Settings tab:

4-1-2009-8.17.26 PM

To retrieve the data, select the country you want the data for from the list on the main screen:

4-1-2009-8.20.42 PM

Click on the country name to select it, not the checkbox – clicking on the checkbox seems to select Afghanistan for every case in addition to the country you want. Once you’re selected the desired country, click “Start”, and the program will start querying the NIMA  database. It uses a brute force approach, where it queries for every possible set of 2-4 starting letters plus a wild card character. Consequently, the search may take quite a bit of time even for small countries, and will usually come up with duplicate entries.  Once complete, the output text file is saved in the “data” subfolder of the main program folder with a two-letter name descriptive of the country (e.g. “AF” for Afghanistan, “AO” for Angola).

You can open the text file in a spreadsheet and do a query or sort to find the information you need. If you saved it in CSV format, you could use a GIS program like MapWindow to convert it into shapefile format., and then query the attribute table. Source code for the app (Visual Basic 6) is also available at the download site.

For the United States, the program is supposed to use a different online database, but that doesn’t seem to be working right now. But a full install of MapWindow includes several sample projects; in the “United States” folder you’ll find the “cities” shapefile, which lists over 3000 US cities,  their elevation above sea level in feet, and other information. You can query this shapefile in a GIS program, or export it into spreadsheet format with Shape2Text.




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.




Get DEM Elevations For A List Of Points

YP asks:

…would you know an easy (and free) way to query a DEM (Digital Elevation Model) to get elevations for a list of points (potentially as many as a few thousand)

Well, I know one way to do it with free software:

Continue reading ‘Get DEM Elevations For A List Of Points’




Garmin BaseCamp Released

If you own a Garmin mapset that includes DEM data, like their 1:24K topographic mapsets or Topo US 2008, you might want to download and take a look at Garmin’s new free 3D map viewer and GPS data editor, BaseCamp. Here’s a screenshot using Topo US 2008 data:

3-30-2009-11.10.29 PM

On the plus side:

  • 2D/3D/Overview map views
  • Elevation profiles along a track
  • Photo geotagging using a GPS track
  • Some advanced editing features, like a track split function and eraser

On the down side:

  • Program is slooooow, even on my fairly recent quad-core system
  • Default 3D view is too subtle, even with decent topography; go to the options section and change the elevation exaggeration to something more useable, like 200%.

It’s probably worth downloading if you have a compatible mapset, but I don’t find the new features compelling enough to make me switch over from Garmin’s older Mapsource program to BaseCamp, especially given how sluggish the latter is. Hopefully future versions will be snappier, and add more features.




The Blue Marble Navigator

NASA’s Next Generation Blue Marble imagery (available here) is a set of 12 monthly composite images of the entire earth, using 500-meter-resolution imagery from the MODIS satellite. The Blue Marble Navigator offers a convenient interface to view this imagery, along with several other useful options.

After selecting your initial location from a world map, the main interface comes up:

Continue reading ‘The Blue Marble Navigator’




Free Introductory Guide To GIS And GPS

MapAction is a non-profit volunteer organization that provides GIS and mapping services to disaster areas. They’ve just published a free 118-page Field Guide To Humanitarian Mapping that’s a terrific introduction to both data acquisition using a GPS, and how to use Google Earth and the free open-source Windows GIS program MapWindow for mapping. I’d even say that it’s a far better choice for beginners than the recently-published GIS For Dummies (more on that soon, when I get the review of that volume done).

Via GIS @ Vassar.




Google Earth Coordinate System Grids

8/13/2009: No longer free; there’s a subscription fee from which a small charge is deducted for every use. A free grid link is still available here for MGRS and UTM.

Earthpoint has a new beta Google Earth function – grid overlays for multiple coordinate systems:

  • Deg – Decimal degrees
  • DegSec – Degrees, Decimal seconds
  • DegSecMin  – Degrees, Seconds, Decimal minutes
  • Georef – World Geographic Reference System
  • UTM/UPS – Universal Transverse Mercator / Universal Polar Stereographic
  • MGRS – Military Grid Reference System

Click the button for the desired grid KML file, and open it in Google Earth (UTM here):

utm grid Google Earth

As you zoom in, the grids become finer; you may have to wait a bit for the network link to catch up:

fine utm grid Google Earth

Roll your mouse over one of the “balls” defining the grid, and get a pop-up with the coordinates (and UTM zone here):

3-18-2009-2.56.29 PM

The crosshair marks the center of the display, the location for which Google Earth shows the coordinates and elevation in the bottom toolbar.