GithubHelp home page GithubHelp logo

specklesystems / speckle-qgis Goto Github PK

View Code? Open in Web Editor NEW
33.0 3.0 6.0 91.58 MB

QGIS Connector for Speckle 2.0

Home Page: https://speckle.systems/tag/qgis/

License: Apache License 2.0

Makefile 0.45% Python 99.19% Batchfile 0.15% Shell 0.09% QML 0.05% HTML 0.07%
gis qgis qgis-plugin speckle aec architecture bim interoperability interop

speckle-qgis's Introduction


Speckle | QGIS

Connector for Spatial Data from QGIS

Speckle is the data infrastructure for the AEC industry.


Twitter Follow Community forum users website docs

About Speckle

What is Speckle? Check our YouTube Video Views

Features

  • Object-based: say goodbye to files! Speckle is the first object based platform for the AEC industry
  • Version control: Speckle is the Git & Hub for geometry and BIM data
  • Collaboration: share your designs collaborate with others
  • 3D Viewer: see your CAD and BIM models online, share and embed them anywhere
  • Interoperability: get your CAD and BIM models into other software without exporting or importing
  • Real time: get real time updates and notifications and changes
  • GraphQL API: get what you need anywhere you want it
  • Webhooks: the base for a automation and next-gen pipelines
  • Built for developers: we are building Speckle with developers in mind and got tools for every stack
  • Built for the AEC industry: Speckle connectors are plugins for the most common software used in the industry such as Revit, Rhino, Grasshopper, AutoCAD, Civil 3D, Excel, Unreal Engine, Unity, QGIS (you are here), Blender and more!

Try Speckle now!

Give Speckle a try in no time by:

  • speckle XYZ ⇒ creating an account at our public server
  • create a droplet ⇒ deploying an instance in 1 click

Resources

  • Community forum users for help, feature requests or just to hang with other speckle enthusiasts, check out our community forum!
  • website our tutorials portal is full of resources to get you started using Speckle
  • docs reference on almost any end-user and developer functionality

Untitled

Repo Structure

This repo contains the QGIS plugin for Speckle 2.0. It is written in python and uses our fantastic Python SDK. The Speckle Server is providing all the web-facing functionality and can be found here.

Try it out!! Although we're still in early development stages, we encourage you to try out the latest stable release. Just follow the instructions on this file, and head to the Releases page to download the necessary files and dependencies.

What can it do?

Currently, the plugin allows to send data from a single layer to a Speckle server using one of the accounts configured on your computer. It will extract all the features of that layer along side their properties and, when possible, geometry too. The following geometry types are supported for now:

  • Point
  • MultiPoint
  • Polyline (LineString)
  • MultiLineString
  • Polygon
  • MultiPolygon
  • More to come!!

Data types currently not supported for sending:

  • Layers depending on the server connection (WMS, WFC, WCS etc.)
  • Scenes
  • Mesh Vector layers
  • Pointclouds

If you have questions, you can always find us at our Community forum

Installation

QGIS Marketplace

You can find Speckle QGIS in the QGIS Plugins -> Manage and install plugins menu item.

The plugin is currently published as experimental, so make sure you go to Settings and activate the Show also experimental plugins checkbox.

Experimental

Then go to the All tab and search for Speckle. You should see the plugin appear in the list. You might need to restart QGIS.

image

Speckle Desktop Manager install

Install Speckle Desktop Manager from here. Click on QGIS plugin to install it:

from_manager1

Launching the Plugin

SpeckleQGIS will appear in the Plugins Toolbar. Click the blue brick in the toolbar to open the plugin.

plugins_toolbar

Developing

Setup

Setup is a bit cumbersome for now. The following is adapted from this tutorial

Qt Creator

To edit the UI of the plugin, you'll want to install Qt creator. You can find the free installers on this page in the "Qt Creator" tab. On Windows, you'll be prompted to create an account during the installation process.

qt creator install

Python Qt Bindings

For Windows, the bindings are already included in the QGIS installation.

For Mac, you can install PyQt using homebrew.

brew install pyqt

Install pb_tool

pb_tool allows you to compile resource files from into something python will understand.

For this plugin we only have one file to convert:

  • resources.qrc -> resources.py

To install pb_tool, just run:

pip install pb_tool

or

YOUR_PYTHON_EXECUTABLE -m pip install pb_tool

For convenience, the pre-compiled resources.py file so you don't really have to do anything here.

Dev Environment

For a better development experience in your editor, we recommend creating a virtual environment. In the venv, you'll just need to install specklepy. You will also need to copy over the qgis module into the {venv}/Lib/site-packages. You can find the qgis module in your QGIS install directory:

  • Windows: C:\Program Files\QGIS 3.28.15\apps\qgis\python
  • MacOS: /Applications/QGIS.app/Contents/Resources/python

qgis dependency for venv

QGIS Plugins

Though it is not required, we recommend installing these plugins from the QGIS Plugin Manager:

  • Plugin Reloader (allows you to reload the plugin without restarting QGIS)
  • Remote Debugger (enables interactive debugging)
  • First Aid (shows errors before crashing QGIS, sometimes)

Debugging

Visual Studio Code

First, you'll need to change the _debug value to True in plugin_utils/installer.py file.

    _debug = True

This will automatically setup debugpy if it's not already installed, and start listening to port 5678.

Select the "Python" -> "Remote Attach" option. Your launch.json should look like this:

{
  "version": "0.2.0",
  "configurations": [
    {
      "name": "Python: Remote Attach",
      "type": "python",
      "request": "attach",
      "port": 5678,
      "host": "localhost",
      "pathMappings": [
        {
          "localRoot": "${workspaceFolder}",
          "remoteRoot": "${workspaceFolder}"
        }
      ]
    }
  ]
}

To start debugging, you'll need to first launch QGIS. Once it's running, run your debug Python: Remote Attach configuration.

That's all there is to it! Now any breakpoints you create should be hit.

successful debugging in vs code

Enjoy!

speckle-qgis's People

Contributors

alanrynne avatar baswein avatar gjedlicska avatar izzylys avatar jr-morgan avatar katkatkateryna avatar sanzoghenzo avatar teocomi avatar tlmnrnhrdt avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

speckle-qgis's Issues

Improvements

  • extra Other category in Symbology;
  • Line width categories;
  • ignore received categorized/graduated symbology if attaced to non-existing attribute (e.g. ID)
  • Inverted color ramp for rasters

On first install (manual method) application restart is required after enabling

Affects PC Install only

After installing into the plugins folder from the repo clone, restarting the application is required to register the plugin (not speckle-QGis issue)

Subsequently, enabling the plugin the manager then gives UI reports of specklepy not being found and the Plugin isn't visible in the UI.

The specklepy dependency has been successfully installed restarting the application solves the issue, but perhaps there is a call to specklpy too early, or if there is some plugin init process that can be handled to check again.

Screenshot 2022-10-13 at 15 06 17

SpeckleException > UI & Exeption

HI,
First, thank you for your effort to make this happen!

I have just taken a test that returns an error.

I am not sure that is the error; I have little knowledge of the nitty-gritty of the tool, and I am a beginner at coding...
I assume that the issue is related exception log to the function that is connected to the User interface.

Or am I doing something wrong?

2022-07-17T12:16:01     WARNING    Traceback (most recent call last):
              File "C:\Users\****\AppData\Roaming\Python\Python39\site-packages\specklepy\api\client.py", line 86, in __init__
              raise serverInfo
             specklepy.logging.exceptions.SpeckleException: SpeckleException: Failed to execute the GraphQL server request. Inner exception: __init__() got an unexpected keyword argument 'allowed_methods'
             
             During handling of the above exception, another exception occurred:
             
             Traceback (most recent call last):
              File "C:\Users\****\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\speckle-qgis\ui\add_stream_modal.py", line 67, in onAccountSelected
              self.speckle_client = SpeckleClient(account.serverInfo.url, account.serverInfo.url.startswith("https"))
              File "C:\Users\****\AppData\Roaming\Python\Python39\site-packages\specklepy\api\client.py", line 90, in __init__
              raise SpeckleException(f"{self.url} is not a compatible Speckle Server", ex)
             specklepy.logging.exceptions.SpeckleException: SpeckleException: https://speckle.xyz is not a compatible Speckle Server

Thank you

Content & Docs

Need to add a section in the doc and create some initial tutorials / getting started pages.

Refactor UI code out of `speckle_qgis.py` and into it's respective UI classes

speckle_qgis.py is currently in charge of doing too many things, making it tricky to edit without introducing new bugs in the process.

Most of this code is UI based (callbacks for clicks, redrawing logic, etc), which should actually live inside it's own python classes.

These already exist but we were just using them as "dumb" wrappers for the UI file. Making them "smarter" would greatly simplify the code in the main plugin file.

QGIS: Continue geometry conversions

Currently only supports points. To the best of my knowledge, we're missing:

  • Multipoint
  • Linestring
  • Multilinestring
  • Polygon
  • Multipolygon
  • Mesh These are not really within our initial scope as they are used mainly for Weather data.
  • PointCloud Could not find any reference to pointClouds on pyQGIS

Feature: Ability to create streams and branches with the UI

This would bring feature parity with other connectors.

The current method is to create streams or branches at the server (or with other connectors) and refresh the QGIS Ui to make these visible.

The add stream button is ambiguous. + means Select for the current project and not Create Stream.

Plugin Icon Missing

Not a big issue in the slightest, but to report, the Speckle QGIS plugin does not present an icon on its toolbar button.

Screenshot 2022-08-19 at 16 05 21

MacOS 12.5.1
QGIS 3.22.3
Speckle 2.7.0

Receiving CAD data

  • define and adapt geometry types to QGIS types
  • create layer properties and styles accordingly

Option 1: fit all polylines into 1 layer, all points into another one etc.
Option 2: read existing layer structure, add sublayers for every type of geometry

Add proper typings to all our QGIS code

Our current code is too generic in many of it's input/outputs, leading to us making silly decisions in code that should be brought up as errors.

Adding proper typing support would remove this problem altogether, while giving us a more stable foundation to move forward.

Missing features in UI

Currently the UI is lacking:

  • Search streams
  • Show latest streams if search is empty.
  • Stream cards (plus storing existing cards in the project)
  • Receiving data (including unit conversion routines)
  • Filters:
    • At least, we should have a "crop box" filter to send only what exists within a specific rectangle (QGIS has methods for this, so it's mostly connecting it to the UI)

I think we should just grab the UI from Blender and replicate it (to the extent we need) just to not "re-invent" the wheel again.

Improvements

  • #31
  • Receiving in the same Style (add Style as sending variable too, now it's just a mesh color)
  • Combine Speckle-received layers into a group
  • fix lost access to accounts (for the saved streams in the project)

Issue when loading speckle plugin in QGIS

I keep getting this issue when loading the Speckle Component in QGIS

Couldn't load plugin 'speckle-qgis' due to an error when calling its classFactory() method

Python version: 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)]
QGIS version: 3.26.2-Buenos Aires Buenos Aires, feec3d3b12f

KeyError totalChildrenCount after successful Send

Hi there,

I think it's best if I file issues directly here instead of polluting the forum discussion...

This is not a blocking error, but QGIS displays a warning after sending a layer to speckle:

Traceback (most recent call last):
  File "C:\Users\andre\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\speckle-qgis\speckle_qgis.py", line 370, in onReceiveButtonClicked
    traverseObject(commitObj, callback, check)
  File "C:\Users\andre\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\speckle-qgis\speckle_qgis.py", line 66, in traverseObject
    traverseValue(base[name], callback, check)
  File "C:\Users\andre\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\speckle-qgis\speckle_qgis.py", line 78, in traverseValue
    traverseValue(item, callback, check)
  File "C:\Users\andre\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\speckle-qgis\speckle_qgis.py", line 75, in traverseValue
    traverseObject(value, callback, check)
  File "C:\Users\andre\AppData\Roaming\QGIS\QGIS3\profiles\default\python\plugins\speckle-qgis\speckle_qgis.py", line 66, in traverseObject
    traverseValue(base[name], callback, check)
  File "C:\Users\andre\AppData\Roaming\Python\Python39\site-packages\specklepy\objects\base.py", line 187, in __getitem__
    return self.__dict__[name]
KeyError: 'totalChildrenCount'

Data is correctly sent and I can receive it in a new QGIS project, though.

I don't know why the onReceiveButtonClicked method gets triggered.

QGIS 3.22.3 with python 3.9.5
speckle-qgis 0.1.1
specklepy 2.5.3

Figure out a release strategy

@izzylys and myself had a chat about it last week, and decided to look into the possibility of packaging everything into the plugin folder by releasing the plugin as a .whl that we can then import on our code.

This idea comes from here: https://gis.stackexchange.com/a/349502

Not sure of the implications of this in the Python SDK and it's CI build process.

QGIS "Manage and Install Plugins" load error

I installed the plugin using the "Manage and Install Plugins" dialog, then received the error below (which also locked up the QGIS UI until I found the error window hidden beneath).

After dismissing the error window, I clicked the button to reinstall the experimental version, reopened QGIS and it appears to be working, but I thought I'd report the error here in case its helpful.

Plugin Version: 0.0.6 (Nov 9th)

Error:

Couldn't load plugin 'speckle-qgis' due to an error when calling its classFactory() method

ModuleNotFoundError: No module named 'specklepy' 
Traceback (most recent call last):
  File "C:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\qgis\utils.py", line 334, in _startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "//dname/users$/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\speckle-qgis\__init__.py", line 43, in classFactory
    from .speckle_qgis import SpeckleQGIS
  File "C:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\qgis\utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "//dname/users$/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\speckle-qgis\speckle_qgis.py", line 31, in 
    from specklepy.api import operations
  File "C:/PROGRA~1/QGIS3~1.16/apps/qgis/./python\qgis\utils.py", line 792, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ModuleNotFoundError: No module named 'specklepy'


Python version: 3.7.0 (v3.7.0:1bf9cc5093, Jun 27 2018, 04:59:51) [MSC v.1914 64 bit (AMD64)] 
QGIS version: 3.16.1-Hannover Hannover, b381a90dca 

Python Path:
C:/PROGRA~1/QGIS3~1.16/apps/qgis/./python
//dname/users$/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python
//dname/users$/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~1/QGIS3~1.16/apps/qgis/./python/plugins
C:\PROGRA~1\QGIS3~1.16\apps\Python37
C:\PROGRA~1\QGIS3~1.16\apps\Python37\Scripts
C:\Program Files\QGIS 3.16\bin\python37.zip
C:\PROGRA~1\QGIS3~1.16\apps\Python37\DLLs
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib
C:\Program Files\QGIS 3.16\bin
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\win32
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\win32\lib
C:\PROGRA~1\QGIS3~1.16\apps\Python37\lib\site-packages\Pythonwin
//dname/users$/user/AppData/Roaming/QGIS/QGIS3\profiles\default/python

===========================================

Visit https://download.qgis.org to get your copy of version 3.16.14

QGIS fixes

  • Show proper warning if the geometry is broken (polygons)
  • Change DisplayValue of polygons to mesh (only if without voids)
  • Sort list of layers in Speckle window (e.g. alphabetically, add # if the name is duplicated)
  • “Reload” → “Refresh”
  • LARGE warning for vector layers too
  • read style (color) for vector layers, set as color/material (single color or categories)
  • replace CRS if layer that is being received already exists (it can be received in different crs type)
  • fix geom.types for layers (strings to int), so it can be read when received back in QGIS
  • receive latest version in the "latest" layer, only update that one
  • upgrade Specklepy (with metrics)

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.