Giter Site home page Giter Site logo

pavlova-marina / qgis-spreadsheetlayers Goto Github PK

View Code? Open in Web Editor NEW

This project forked from camptocamp/qgis-spreadsheetlayers

0.0 1.0 0.0 116 KB

QGIS plugin to load layers from spreadsheet files (*.ods, *.xls, *.xlsx)

Makefile 21.15% Python 68.86% Batchfile 9.98%

qgis-spreadsheetlayers's Introduction

QGIS-SpreadSheetLayers

QGIS plugin to load layers from spreadsheet files (*.ods, *.xls, *.xlsx)

Description

This plugin adds a Add spreadsheet layer entry in Layer / Add new Layer menu and a corresponding button in Layers toolbar. These two links open the same dialog to load a layer from a spreadsheet file with some options:

  • select file
  • layer name
  • sheet selection
  • header at first line
  • ignore some rows
  • load geometry from x and y fields

When dialog is accepted, it creates a new GDAL VRT file in same folder as the source data file, expanded with a .vrt suffix, which is loaded into QGIS.

When reusing the same file twice, the dialog loads its values from the existing .vrt file.

Limitations

Due to a GDAL/OGR lacks of functionalities:

  • use of header line on a per file basis ;
  • ignore lines at the beginning of file ;
  • correct end of .xls files detection.

The plugin use an SQLITE select statement with offset and limit parameters to extract corresponding data from the source file. When one of this functionalities is in use, this could have some side effects.

With GDAL <= 1.11.1, the plugin can't load geometry. With graceful degradation, geometry checkbox is then locked. To get the GDAL version in use, run this commands in QGIS python console:

import osgeo.gdal
print osgeo.gdal.__version__

When opening a spreadsheet file, GDAL/OGR will try to detect the data type of columns (Date, Integer, Real, String, ...). This automatic detection occurs outside of plugin header and ignore lines functionalities, so when using this, GDAL/OGR should be unable to correctly detect data types.

Configuration

GDAL do not allow to define the presence of header line on a per layer basis, this choice is made through environment variables for each driver OGR_ODS_HEADERS, OGR_XLS_HEADERS and OGR_XLSX_HEADERS, with tree possible values FORCE, DISABLE and AUTO. For more details, consult the corresponding drivers documentation ie: http://www.gdal.org/drv_ods.html, http://www.gdal.org/drv_xls.html and http://www.gdal.org/drv_xlsx.html.

You can change this values in QGIS settings:

  • open Settings / Options dialog;

  • select System tab, and go to Environnement section;

  • check Use custom variables.

  • add a new line. Example:

    Overwrite | OGR_ODS_HEADERS | FORCE

  • restart QGIS to take this into consideration.

Development install (linux)

git clone [email protected]:camptocamp/QGIS-SpreadSheetLayers.git SpreadsheetLayers
ln -s SpreadsheetLayers ~/.qgis2/python/plugins/
cd SpreadsheetLayers
make
  • run QGIS and activate SpreadsheetLayers plugin.

qgis-spreadsheetlayers's People

Contributors

arnaud-morvan avatar pavlova-marina avatar

Watchers

 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.