Commit fb4e7a90 authored by Daniel Childs's avatar Daniel Childs

added support for reading strikes

parent 6ae41eb7
......@@ -5,19 +5,19 @@
A QGIS plugin
Displays a geologic stereonet of selected data
-------------------
begin : 2016-11-29
copyright : (C) 2016 by Daniel Childs
email : daniel@childsgeo.com
git sha : $Format:%H$
begin : 2016-11-29
copyright : (C) 2016 by Daniel Childs
email : daniel@childsgeo.com
git sha : $Format:%H$
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
This script initializes the plugin, making it known to QGIS.
"""
......@@ -46,9 +46,7 @@ class Stereonet:
self.contourAction = QAction(QIcon(str(dir_path)+"/icon.png"), u'Stereonet', self.iface.mainWindow())
self.contourAction.triggered.connect(self.contourPlot)
self.iface.addToolBarIcon(self.contourAction)
print(dir_path)
print(dir_path,'v1')
def unload(self):
self.iface.removeToolBarIcon(self.contourAction)
......@@ -75,17 +73,25 @@ class Stereonet:
fig, ax = mplstereonet.subplots()
strikes = list()
dips = list()
try:
layers = self.iface.legendInterface().layers()
for layer in layers:
layers = self.iface.legendInterface().layers()
for layer in layers:
if layer.type() == QgsMapLayer.VectorLayer:
iter = layer.selectedFeatures()
strikeExists = layer.fieldNameIndex('strike')
ddrExists = layer.fieldNameIndex('ddr')
dipExists = layer.fieldNameIndex('dip')
for feature in iter:
strikes.append(feature['ddr']-90)
dips.append(feature['dip'])
cax = ax.density_contourf(strikes, dips, measurement='poles',cmap=cm.coolwarm)
ax.pole(strikes, dips, 'k+', markersize=7)
ax.grid(True)
fig.colorbar(cax)
plt.show()
except:
return
\ No newline at end of file
if strikeExists != -1 and dipExists != -1:
print(feature['strike'],feature['dip'])
strikes.append(feature['strike'])
dips.append(feature['dip'])
elif ddrExists != -1 and dipExists != -1:
strikes.append(feature['ddr']-90)
dips.append(feature['dip'])
else:
continue
cax = ax.density_contourf(strikes, dips, measurement='poles',cmap=cm.coolwarm)
ax.pole(strikes, dips, 'k+', markersize=7)
ax.grid(True)
fig.colorbar(cax)
plt.show()
\ No newline at end of file
......@@ -10,11 +10,11 @@
name=Stereonet
qgisMinimumVersion=2.14
description=Displays a geologic stereonet of selected data
version=0.1
version=0.2
author=Daniel Childs
email=daniel@childsgeo.com
about=Displays a geologic stereonet of selected geologic structure data. Data needs to be in a csv format with the dip direction under the column "DDR" and dip under the column "dip"
about=Displays a geologic stereonet of selected geologic structure data. Data needs to be loaded into QGIS via "Delimited Text Layer." A stereonet will be plotted if there is a column labeled "Strike" or "DDR" and "Dip" (case doesn't matter). Poles of the structures are plotted on an equal area stereonet with a modified Kamb method contouring.
tracker=https://github.com/daniel-childs/qgis-stereonet/issues
repository=https://github.com/daniel-childs/qgis-stereonet
......@@ -23,7 +23,7 @@ repository=https://github.com/daniel-childs/qgis-stereonet
# Recommended items:
# Uncomment the following line and add your changelog:
# changelog=
changelog=Added support for having either strikes or dip directions of the geologic structures
# Tags are comma separated with spaces allowed
tags=attribute, csv, geology, stereonet, structure
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment