Giter Club home page Giter Club logo

Comments (10)

riccardoklinger avatar riccardoklinger commented on August 18, 2024

from hqgis.

norrye avatar norrye commented on August 18, 2024

Hi Ricardo, I'll pick this up. I have been trying to use the POI search function on macosx, using the latest version of hqgis and 3.18.1-Zurich Qgis version and get the following python error when using the Single layer input option:
2021-04-19T15:38:22 WARNING Traceback (most recent call last):
File "/Users/tim/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Hqgis/hqgis.py", line 1033, in getPlacesBatch
if (originLayer.wkbType() == 4
UnboundLocalError: local variable 'originLayer' referenced before assignment

I have used a shape file (point not multipoint) and a map info tab file as input, they are attached.
pointlayers.zip

Additionally I cannot get the single address input search to work either, the geocode is fine e.g. input the following address:174 cressy rd, North Ryde, 2113, new, Australia and the api returns the coords. -33.80161, 151.13492 but when I select every category and then click find POI's nothing happens, no error message or data returned.

Can you check if you can reproduce the issues?

Cheers

from hqgis.

riccardoklinger avatar riccardoklinger commented on August 18, 2024

from hqgis.

omarcella1 avatar omarcella1 commented on August 18, 2024

Hi, Ricardo!

Which phyton file must be changed the POI's values? I'm with the same error... I modify the "categories.md" put the Here categories ID (https://developer.here.com/documentation/places/dev_guide/topics/place_categories/category-400-transport.html#category-4000-airport) but still the same error.

My Best,
Marcella

from hqgis.

norrye avatar norrye commented on August 18, 2024

Hi norrye, Yes, the problem is reproducible. HERE changed the category system and created a number scheme for this: https://developer.here.com/documentation/places/dev_guide/topics/place_categories/category-400-transport.html#category-4000-airport as an example: https://browse.search.hereapi.com/v1/browse?at=-33.86960,151.20691&categories=400-4000-4581&limit=100&apiKey=YOUR_FANCY_KEY --> works! but currently hqgis is sending: https://browse.search.hereapi.com/v1/browse?at=-33.86960,151.20691&categories=airport&limit=100&apiKey=YOUR_FANCY_KEY --> this results in a wrong server side response. So yes, I can reproduce the problems in 3.16. Can you help with this? Best regards Riccardo

______________________________________ "The best model for a cat is another, or preferably the same cat."
On Mon, Apr 19, 2021 at 7:59 AM norrye @.***> wrote: Hi Ricardo, I'll pick this up. I have been trying to use the POI search function on macosx, using the latest version of hqgis and 3.18.1-Zurich Qgis version and get the following python error when using the Single layer input option: 2021-04-19T15:38:22 WARNING Traceback (most recent call last): File "/Users/tim/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Hqgis/hqgis.py", line 1033, in getPlacesBatch if (originLayer.wkbType() == 4 UnboundLocalError: local variable 'originLayer' referenced before assignment I have used a shape file (point not multipoint) and a map info tab file as input, they are attached. pointlayers.zip https://github.com/riccardoklinger/Hqgis/files/6333538/pointlayers.zip Additionally I cannot get the single address input search to work either, the geocode is fine e.g. input the following address:174 cressy rd, North Ryde, 2113, new, Australia and the api returns the coords. -33.80161, 151.13492 but when I select every category and then click find POI's nothing happens, no error message or data returned. Can you check if you can reproduce the issues? Cheers — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#65 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABYJH2IMN7VFF2BNBU7GFT3TJPBFVANCNFSM4WPCSU7Q .

Hi Riccardo - Thanks for confirming. I can help by testing etc.. I am not a coder. How can I help you?

Cheers

from hqgis.

suhairkilliyath avatar suhairkilliyath commented on August 18, 2024

Hey Riccardo and norrye,

Hope you are doing well. I was wondering if you were able to find a way around this. I am getting the same error while querying by single layer input.
"An error has occurred while executing Python code:

UnboundLocalError: local variable 'originLayer' referenced before assignment
Traceback (most recent call last):
File "/Users/suhairkilliyath/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/Hqgis/hqgis.py", line 1033, in getPlacesBatch
if (originLayer.wkbType() == 4
UnboundLocalError: local variable 'originLayer' referenced before assignment

Python version: 3.7.7 (default, Sep 22 2020, 10:25:18) [Clang 12.0.0 (clang-1200.0.32.2)]
QGIS version: 3.16.3-Hannover Hannover, 3a90ea3afd

Python Path:
/Applications/QGIS.app/Contents/MacOS/../Resources/python
/Users/suhairkilliyath/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/suhairkilliyath/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Applications/QGIS.app/Contents/MacOS/../Resources/python/plugins
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/matplotlib-3.3.0-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/patsy-0.5.1-py3.7.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/netCDF4-1.5.3-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/statsmodels-0.11.1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/affine-2.3.0-py3.7.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/Pillow-7.2.0-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/lib-dynload
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/GDAL-3.1.2-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python37.zip
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/numpy-1.19.1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/Rtree-0.9.4-py3.7.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/geopandas-0.8.1-py3.7.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/rasterio-1.1.5-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/click_plugins-1.1.1-py3.7.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/pandas-1.1.0-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/snuggs-1.4.7-py3.7.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/opencv_contrib_python-4.3.0.36-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/pyproj-2.6.0-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/numba-0.50.1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/Fiona-1.8.13.post1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/scipy-1.5.1-py3.7-macosx-10.13.0-x86_64.egg
/Applications/QGIS.app/Contents/MacOS/lib/python3.7/site-packages/cftime-1.2.1-py3.7-macosx-10.13.0-x86_64.egg
/Users/suhairkilliyath/Library/Application Support/QGIS/QGIS3/profiles/default/python
/Users/suhairkilliyath/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/qgis2web
/Users/suhairkilliyath/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins
/Users/suhairkilliyath/Library/Application Support/QGIS/QGIS3/profiles/default/python/plugins/mmqgis/forms"

In addition,

In thee plugin window:
"This plugin is broken. Missing metadata file
__MACOSX
"

from hqgis.

riccardoklinger avatar riccardoklinger commented on August 18, 2024

hi @suhairkilliyath , the layer problem might be non-related but without seeing/ working with the layer in question it is hard to tell. _MacOSX Problem is known and will be fixed in the next release.

from hqgis.

pdpferreira avatar pdpferreira commented on August 18, 2024

in addition to the categories having changed, in hqgis.py, there is bug in getPlacesBatch function.
You need to do "originLayer = self.dlg.FindPOISLayer.currentLayer()" before "if (originLayer.wkbType() == 4"

def getPlacesBatch(self):
        self.getCredentials()
        #radius = self.dlg.RadiusBoxBatch.value()
        categories = self.dlg.listWidgetBatch.selectedItems()
        categoriesList = []
        for category in categories:
            categoriesList.append(category.text())
        categories = ",".join(categoriesList)
        layer = self.createPlaceLayerBatch()
        **originLayer = self.dlg.FindPOISLayer.currentLayer()**
        # allow only regular point layers. no Multipoints
        if (originLayer.wkbType() == 4
            or originLayer.wkbType() == 1004
                or originLayer.wkbType() == 3004):
            self.iface.messageBar().pushWarning(
                'Failed', 'Please convert MultiPoint layer to Point layer before usage')
            return
        **#originLayer = self.dlg.FindPOISLayer.currentLayer()**
        originFeatures = originLayer.getFeatures()
        layerCRS = originLayer.crs()

Another problem is with de id type, the id is a string not an int.

    def createPlaceLayerBatch(self):
        layer = QgsVectorLayer(
            "Point?crs=EPSG:4326",
            "PlaceLayer",
            "memory"
        )
        layer.dataProvider().addAttributes([
            **QgsField("id", QVariant.String),**
            QgsField("origin_id", QVariant.Int),
            QgsField("title", QVariant.String),
            QgsField("label", QVariant.String),
            QgsField("distance", QVariant.Double),
            QgsField("categories", QVariant.String)
        ])
        layer.updateFields()
        return(layer)

from hqgis.

riccardoklinger avatar riccardoklinger commented on August 18, 2024

Hi folks, I am working on branch version2 and this has a working verison of the POI search around a point. could need your help in transforming the category system into a well defined list of dicts.
target structure:

            {
                "name": "Nightlife-Entertainment",
                "categories": "200-2000-0000,200-2000-0011,200-2000-0012,200-2000-0013,200-2000-0014,200-2000-0015,200-2000-0016,200-2000-0017,200-2000-0018,200-2000-0019,200-2000-0306,200-2000-0368",
            },
            {
                "name": "Cinema",
                "categories": "200-2100-0019",
            },
            {
                "name": "Theatre, Music and Culture",
                "categories": "200-2200-0000,200-2200-0020",
            },

Source is coming from here: https://developer.here.com/documentation/geocoding-search-api/dev_guide/topics-places/places-category-system-full.html

from hqgis.

Related Issues (20)

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.