Skip to content

Commit

Permalink
update credits
Browse files Browse the repository at this point in the history
  • Loading branch information
t-book committed Jul 1, 2024
1 parent 0b798a7 commit 33d0c1c
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 30 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# -------------------
# begin : 2023-09-11
# git sha : $Format:%H$
# copyright : (C) 2023 by cuprit gbr
# email : toni.schoenbuchner@cuprit.net
# copyright : (C) 2023 by csgis gbr
# email : toni.schoenbuchner@csgis.net
# ***************************************************************************/
#
#/***************************************************************************
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Everything you need to know:

**Docs:** http://kgr-finder-docs.cuprit.net/
**Docs:** http://kgr-finder-docs.csgis.net/


**Lisence:** https://www.gnu.org/licenses/gpl-3.0.en.html
4 changes: 2 additions & 2 deletions data_apis.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def getAttributeMappings(self):

def extractElements(self, data):
if not data:
return None
return []
# Extract elements from the Overpass API response
return data.get("elements", [])

Expand Down Expand Up @@ -264,7 +264,7 @@ def getAttributeMappings(self):

def extractElements(self, data):
if not data:
return None
return []
# Extract elements from the Overpass API response
return data.get("result", [])

Expand Down
4 changes: 2 additions & 2 deletions find_osm_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
-------------------
begin : 2023-09-11
git sha : $Format:%H$
copyright : (C) 2023 by cuprit gbr
email : toni.schoenbuchner@cuprit.net
copyright : (C) 2023 by csgis gbr
email : toni.schoenbuchner@csgis.net
***************************************************************************/
/***************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions find_osm_data_dockwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
-------------------
begin : 2023-09-11
git sha : $Format:%H$
copyright : (C) 2023 by cuprit gbr
email : toni.schoenbuchner@cuprit.net
copyright : (C) 2023 by csgis gbr
email : toni.schoenbuchner@csgis.net
***************************************************************************/
/***************************************************************************
Expand Down
4 changes: 2 additions & 2 deletions kgr_finder.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
A QGIS plugin for detecting cultura places
-------------------
begin : 2023-09-11
copyright : (C) 2023 by cuprit gbr
email : toni.schoenbuchner@cuprit.net
copyright : (C) 2023 by csgis gbr
email : toni.schoenbuchner@csgis.net
***************************************************************************/
/***************************************************************************
Expand Down
10 changes: 5 additions & 5 deletions metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ name=KGR Finder
qgisMinimumVersion=3.0
description=This QGIS Plugin allows Users to currently download data from OpenStreetMap and/or iDAI.Gazetteer either by drawing a rectangle or by selecting a polygon layer.
version=0.1
author=cuprit GbR.
email=toni.schoenbuchner@cuprit.net
author=csgis GbR.
email=toni.schoenbuchner@csgis.net

about=Find cultural heritage from different sources like OpenStreetMap, iDAI.Gazetteer etc.

tracker=https://github.com/cuprit-gbr/KGRFinder-docs/issues
repository=https://github.com/cuprit-gbr/KGRFinder-docs
tracker=https://github.com/csgis-gbr/KGRFinder-docs/issues
repository=https://github.com/csgis-gbr/KGRFinder-docs
# End of mandatory metadata

# Recommended items:
Expand All @@ -25,7 +25,7 @@ hasProcessingProvider=no
# Tags are comma separated with spaces allowed
tags=python,osm,iDAI.Gazetteer,heritage,cultural,

homepage=https://kgr-finder-docs.cuprit.net/
homepage=https://kgr-finder-docs.csgis.net/
category=Plugins
icon=assets/greif.png
# experimental flag
Expand Down
4 changes: 2 additions & 2 deletions pb_tool.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
# Generated by Plugin Builder: http://g-sherman.github.io/Qgis-Plugin-Builder/
# -------------------
# begin : 2023-09-11
# copyright : (C) 2023 by cuprit gbr
# email : toni.schoenbuchner@cuprit.net
# copyright : (C) 2023 by csgis gbr
# email : toni.schoenbuchner@csgis.net
# ***************************************************************************/
#
#/***************************************************************************
Expand Down
52 changes: 40 additions & 12 deletions tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,31 @@ def __init__(self, canvas):
self.api_strategies.append(iDAIGazetteerAPIQueryStrategy())
Log.log_debug(str(self.api_strategies))

def checkAreaSize(self, x_min, y_min, x_max, y_max, threshold=500):
area = (x_max - x_min) * (y_max - y_min)
def checkAreaSize(self, x_min, y_min, x_max, y_max, threshold=1000000000):
area_sqm = (x_max - x_min) * (y_max - y_min)

if area > threshold:
# Conversion factors
sqm_to_km2 = 1 / 1_000_000
sqm_to_ha = 1 / 10_000

# Convert area to km² and ha
area_km2 = area_sqm * sqm_to_km2
area_ha = area_sqm * sqm_to_ha

# Convert threshold to km² and ha
threshold_km2 = threshold * sqm_to_km2
threshold_ha = threshold * sqm_to_ha

if area_sqm > threshold:
reply = QMessageBox.question(
iface.mainWindow(),
"Large Polygon Detected",
f"The selected area is {area:.2f} square meters, which is larger than {threshold} square meters. "
"This may result in a long API request. Do you want to continue?",
"WARNING: Large Polygon Detected",
f"WARNING: Large Polygon Detected \n\n"
f"The selected area is {area_km2:.2f} km², "
f"which exceeds the threshold of {threshold_km2:.2f} km².\n\n"
"Proceeding with this selection may result in a lengthy API request, potentially causing delays, "
"request failures, or QGIS crashing.\n\n"
"Do you still want to continue?",
QMessageBox.Yes | QMessageBox.No,
QMessageBox.No,
)
Expand All @@ -69,6 +85,7 @@ def checkAreaSize(self, x_min, y_min, x_max, y_max, threshold=500):

return True


def addFeature(self, feature):
self.polygons_features_must_be_within.append(feature)

Expand Down Expand Up @@ -176,12 +193,23 @@ def addFeaturesByStrategy(
):
polygon_layer.dataProvider().addFeature(feature)

iface.messageBar().pushMessage(
"KGR",
"Data from " + strategy.source + " loaded",
level=Qgis.Success,
duration=3,
)
print("here")
print(elements)

if len(elements) == 0:
iface.messageBar().pushMessage(
"KGR",
"No Data from " + strategy.source + " received",
level=Qgis.Warning,
duration=3,
)
else:
iface.messageBar().pushMessage(
"KGR",
"Data from " + strategy.source + " loaded",
level=Qgis.Success,
duration=3,
)

def createFeature(self, element, fields, attribute_mappings, strategy):
geometry_type = strategy.getGeometryType(element)
Expand Down

0 comments on commit 33d0c1c

Please sign in to comment.