Skip to content

Commit

Permalink
🎉 QGIS v3 対応版リリース
Browse files Browse the repository at this point in the history
- 🎉 QGIS v3 対応版リリース
- 📝 README 修正
  • Loading branch information
dayjournal committed Mar 14, 2018
1 parent 923ca89 commit d1e5176
Show file tree
Hide file tree
Showing 9 changed files with 208 additions and 171 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@

img/.DS_Store
.DS_Store
22 changes: 13 additions & 9 deletions JapanElevation.py
Expand Up @@ -6,25 +6,28 @@
Display elevation value of specified position on QGIS.
Using Elevation API by Geospatial Information Authority of Japan.
-------------------
begin : 2017-05-06
begin : 2018-03-14
git sha : $Format:%H$
copyright : (C) 2017 by Yasunori Kirimoto
copyright : (C) 2018 by Yasunori Kirimoto
email : contact@day-journal.com
license : GNU General Public License v2.0
***************************************************************************/
"""

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from PyQt5.QtCore import QSettings, QTranslator, qVersion, QCoreApplication
from PyQt5.QtGui import QIcon
from PyQt5.QtWidgets import QAction
from qgis.core import *
from qgis.gui import *
import resources
from JapanElevation_dialog import JapanElevationDialog

from .resources import *
from .JapanElevation_dialog import JapanElevationDialog

import os.path
import os
import sys
import codecs
import urllib2
import urllib.request, urllib.error, urllib.parse
import json

class JapanElevation:
Expand Down Expand Up @@ -94,6 +97,7 @@ def unload(self):
def run(self):
self.toolClick = QgsMapToolClick(self.iface, self.canvas, self.dlg)
self.canvas.setMapTool(self.toolClick)

class QgsMapToolClick(QgsMapTool):
def __init__(self, iface, canvas, dlg):
QgsMapTool.__init__(self, canvas)
Expand All @@ -105,12 +109,12 @@ def canvasPressEvent(self, mouseEvent):
dPos = mouseEvent.pos()
mPosBefore = self.toMapCoordinates(dPos)
destcrs = self.iface.mapCanvas().mapSettings().destinationCrs()
Tf = QgsCoordinateTransform(destcrs,QgsCoordinateReferenceSystem(4326))
Tf = QgsCoordinateTransform(destcrs, QgsCoordinateReferenceSystem(4326), QgsProject.instance())
mPos = Tf.transform(mPosBefore)
lon = mPos.x()
lat = mPos.y()
URL = "http://cyberjapandata2.gsi.go.jp/general/dem/scripts/getelevation.php?lon=" + str(lon) + "&lat=" + str(lat) +"&outtype=JSON"
data_all = urllib2.urlopen(URL)
data_all = urllib.request.urlopen(URL)
data = json.loads(data_all.read())
elevationall = str(data['elevation'])+ u' m'
elevationtext = data[u'hsrc']
Expand Down
9 changes: 5 additions & 4 deletions JapanElevation_dialog.py
Expand Up @@ -6,20 +6,21 @@
Display elevation value of specified position on QGIS.
Using Elevation API by Geospatial Information Authority of Japan.
-------------------
begin : 2017-05-06
begin : 2018-03-14
git sha : $Format:%H$
copyright : (C) 2017 by Yasunori Kirimoto
copyright : (C) 2018 by Yasunori Kirimoto
email : contact@day-journal.com
license : GNU General Public License v2.0
***************************************************************************/
"""

import os
from PyQt4 import QtCore, QtGui, uic

from PyQt5 import uic, QtWidgets, QtCore
FORM_CLASS, _ = uic.loadUiType(os.path.join(
os.path.dirname(__file__), 'JapanElevation_dialog_base.ui'))

class JapanElevationDialog(QtGui.QDialog, FORM_CLASS):
class JapanElevationDialog(QtWidgets.QDialog, FORM_CLASS):
def __init__(self, parent=None):
super(JapanElevationDialog, self).__init__(parent)
self.setWindowFlags(QtCore.Qt.WindowStaysOnTopHint)
Expand Down
6 changes: 3 additions & 3 deletions JapanElevation_dialog_base.ui
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>206</width>
<width>218</width>
<height>102</height>
</rect>
</property>
Expand All @@ -16,7 +16,7 @@
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>90</x>
<x>110</x>
<y>10</y>
<width>111</width>
<height>41</height>
Expand All @@ -34,7 +34,7 @@
<widget class="QLabel" name="label_2">
<property name="geometry">
<rect>
<x>90</x>
<x>110</x>
<y>50</y>
<width>111</width>
<height>41</height>
Expand Down
12 changes: 8 additions & 4 deletions README.md
@@ -1,11 +1,13 @@
# JapanElevation
![README01](./img/README01.png)

Display elevation value of specified position on QGIS.
Display elevation value of specified position on QGIS.(QGISv3)
Using [Elevation API](http://maps.gsi.go.jp/development/api.html) by Geospatial Information Authority of Japan.

[QGIS Python Plugins Repository](https://plugins.qgis.org/plugins/JapanElevation)

[QGISv2 Repository](https://github.com/dayjournal/JapanElevation/tree/QGIS2)

<br/>

## Usage
Expand All @@ -18,7 +20,7 @@ Using [Elevation API](http://maps.gsi.go.jp/development/api.html) by Geospatial
## License
Python modules are released under the GNU General Public License v2.0

Copyright (c) 2017 Yasunori Kirimoto
Copyright (c) 2018 Yasunori Kirimoto

<br/>

Expand All @@ -33,11 +35,13 @@ Copyright (c) 2017 Yasunori Kirimoto
# 標高値取得
![README01](./img/README01.png)

QGISで指定位置の標高値を表示
QGISで指定位置の標高値を表示(QGISv3)
国土地理院の[標高API](http://maps.gsi.go.jp/development/api.html)を利用

[QGIS Python Plugins Repository](https://plugins.qgis.org/plugins/JapanElevation)

[QGISv2 Repository](https://github.com/dayjournal/JapanElevation/tree/QGIS2)

<br/>

## 使用方法
Expand All @@ -50,7 +54,7 @@ QGISで指定位置の標高値を表示
## ライセンス
Python modules are released under the GNU General Public License v2.0

Copyright (c) 2017 Yasunori Kirimoto
Copyright (c) 2018 Yasunori Kirimoto

<br/>

Expand Down
6 changes: 3 additions & 3 deletions __init__.py
Expand Up @@ -6,14 +6,14 @@
Display elevation value of specified position on QGIS.
Using Elevation API by Geospatial Information Authority of Japan.
-------------------
begin : 2017-05-06
begin : 2018-03-14
git sha : $Format:%H$
copyright : (C) 2017 by Yasunori Kirimoto
copyright : (C) 2018 by Yasunori Kirimoto
email : contact@day-journal.com
license : GNU General Public License v2.0
***************************************************************************/
"""

def classFactory(iface):
from .JapanElevation import JapanElevation
return JapanElevation(iface)
return JapanElevation(iface)
Binary file modified img/README02.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 3 additions & 4 deletions metadata.txt
@@ -1,13 +1,13 @@

[general]
name=JapanElevation
qgisMinimumVersion=2.14
qgisMinimumVersion=3.0
description=JapanElevation
version=1.0
version=2.0
author=YasunoriKirimoto
email=contact@day-journal.com

about=Display elevation value of specified position on QGIS. Using Elevation API by Geospatial Information Authority of Japan.
about=Display elevation value of specified position on QGIS. Using Elevation API by Geospatial Information Authority of Japan.

tracker=https://github.com/dayjournal/JapanElevation/issues
repository=https://github.com/dayjournal/JapanElevation
Expand All @@ -23,4 +23,3 @@ experimental=False

# deprecated flag (applies to the whole plugin, not just a single version)
deprecated=False

0 comments on commit d1e5176

Please sign in to comment.