Coder Social home page Coder Social logo

shapefile_reader's Introduction

Shapefile Reader

A Ruby library that can be used to read ESRI Shapefiles.

What is a Shapefile?

A shapefile stores nontopological geometry and attribute information for the spatial features in a data set. The geometry for a feature is stored as a shape comprising a set of vector coordinates.

Because shapefiles do not have the processing overhead of a topological data structure, they have advantages over other data sources such as faster drawing speed and edit ability. Shapefiles handle single features that overlap or that are noncontiguous. They also typically require less disk space and are easier to read and write.

Shapefiles can support point, line, and area features. Area features are represented as closed loop, double-digitized polygons. Attributes are held in a dBASE® format file. Each attribute record has a one-to-one relationship with the associated shape record.

Main File Header

Method Name Description Example Value
file_code File code (always hex value 0x0000270a) 9994
file_length Size of the file, including the header, in bytes 49915112
version Version of the file 1000
shape_type The type of shape contained in the file. All shapes will either be the specified shape or null. You can see the list below to see what values map to what shapes. 1
x_min Minimum x value of all shapes -179.14734
x_max Maximum x value of all shapes 179.77848
y_min Minimum y value of all shapes 71.38921
y_max Minimum y value of all shapes 18.91112
z_min Minumum z value of all shapes (Optional) 0.0
z_max Maximum z value of all shapes (Optional) 0.0
m_min Minimum measured value (Optional) 0.0
m_max Maximum measure value (Optional) 0.0

Usage

reader = Shapefile::Reader.new(path_to_shapefile)
reader.main_file_header

Read Records

reader = Shapefile::Reader.new(path_to_shapefile)
reader.each_record do |header, shape|
  # Your code here...
end

shapefile_reader's People

Contributors

karayusuf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.