RGeo component for reading ESRI shapefiles
Latest commit 5f0753e Jan 31, 2017 @teeparham teeparham Version 0.4.2
Failed to load latest commit information.
.gitignore Quick test to see if fastercsv really needs to be called out separately Aug 3, 2012
.rubocop_todo.yml [style] empty else Feb 5, 2016
Gemfile [style] Quotes Feb 5, 2016
History.md Version 0.4.2 Jan 31, 2017
LICENSE.txt Updates to match development environment for other gems Jul 1, 2014
README.md Update readme [ci skip] Feb 5, 2016
Rakefile [style] Quotes Feb 5, 2016
rgeo-shapefile.gemspec Use rake 12 Dec 31, 2016



Gem Version Build Status

RGeo::Shapefile is an optional module for RGeo for reading geospatial data from ESRI shapefiles.


RGeo is a key component for writing location-aware applications in the Ruby programming language. At its core is an implementation of the industry standard OGC Simple Features Specification, which provides data representations of geometric objects such as points, lines, and polygons, along with a set of geometric analysis operations. See the README for the rgeo gem for more information.

RGeo::Shapefile is an optional RGeo add-on module for reading geospatial data from ESRI shapefiles. The shapefile format is a common file format for geospatial data sets. It is specified in this ESRI whitepaper.


require 'rgeo/shapefile'

RGeo::Shapefile::Reader.open('myshpfil.shp') do |file|
  puts "File contains #{file.num_records} records."
  file.each do |record|
    puts "Record number #{record.index}:"
    puts "  Geometry: #{record.geometry.as_text}"
    puts "  Attributes: #{record.attributes.inspect}"
  record = file.next
  puts "First record geometry was: #{record.geometry.as_text}"


RGeo::Shapefile has the following requirements:

  • Ruby 2.0.0 or later
  • rgeo 0.3.13 or later.
  • dbf 3.0 or later.

Include in your bundle:

gem 'rgeo-shapefile'

Install RGeo::Shapefile as a gem:

gem install rgeo-shapefile

See the README for the "rgeo" gem, a required dependency, for further installation information.

If you are using Ruby 1.8, use version 0.2.x of this gem.

If you are using Ruby 1.9, use version 0.3.x of this gem.

Development and support

Documentation is available at http://rdoc.info/gems/rgeo-shapefile

Source code is hosted on Github at https://github.com/rgeo/rgeo-shapefile

Contributions are welcome. Fork the project on Github.

Report bugs on Github issues at https://github.com/rgeo/rgeo-shapefile/issues


rgeo-shapefile was orginally written by Daniel Azuma (http://www.daniel-azuma.com).

Development is supported by:

Although we don't use shapelib (http://shapelib.maptools.org) to read ESRI shapefiles, we did borrow a bunch of their test cases.


Copyright Daniel Azuma, Tee Parham