Re: [QGIS-Developer] GeomFromText cuts decimal values, it works, thanks!

2022-08-11 Thread Prof . Dr . Jörg Höttges via QGIS-Developer

Hi,

many thanks, it works. Until today I could always rely on the fact that the decimal point worked in programming 
languages and databases. So I didn't expect that...


By the way: In SpatialiteGUI everthing worked fine...

Best wishes

Jörg


Am 11.08.2022 um 14:08 schrieb Werner Macho:

Hi!
Back on my computer I just tried your exact first example on a fresh created gpkg layer in the database window in QGIS 
3.26.1 on a german Version of Windows 10:

SELECT aswkt(GEOMFROMTEXT('POINT(340178.042761887 5659302.0567476)',25832)) as 
geom
and the result is:
geom
POINT(340178.042761887 5659302.0567476)

Which version of QGIS on what OS you are on?
Maybe you set some language settings in the OS (or even maybe in QGIS itself?)

regards
Werner

On Thu, Aug 11, 2022 at 1:31 PM FH Aachen  wrote:

Hi Werner,

yes, i did... But it didn't work. Especially not for line objects or 
polygons: GeomFromText('LineString(35.123
560, 350020.456 560)'), because the comma ist used to seperate the 
coordinate value pairs.

Regards
Jörg

11.08.2022 12:46:07 Werner Macho via QGIS-Developer 
:

> Hi,
> Have you tried to substitute point with comma?
> Worth a try.
>
> Regards werner
> ___
> QGIS-Developer mailing list
> QGIS-Developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



smime.p7s
Description: S/MIME Cryptographic Signature
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[QGIS-Developer] GeomFromText cuts decimal values

2022-08-11 Thread Prof . Dr . Jörg Höttges via QGIS-Developer

Hi list,

in the database window of QGIS 3.24.3 I tried to create geometries via 
GEOMFROMTEXT, but with

   SELECT aswkt(GEOMFROMTEXT('POINT(340178.042761887 5659302.0567476)',25832)) 
as geom

i get

   geom
   POINT(340178 5659302)

where the decimal part has been lost. Have i done something wrong?

Kind regards,

Jörg Höttges



smime.p7s
Description: S/MIME Cryptographic Signature
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[QGIS-Developer] Fwd: [Qgis-user] Editing a multipolygon object changes type from Multipolygon to Polygon

2022-04-01 Thread Jörg Höttges via QGIS-Developer

Hi everyone,

I'm using QGIS 3.16 to 3.22. I created a table with multipolygon objects in a SpatiaLite database. When editing one of 
the polygons there appears a warning "Die Operation würden Geometrietyp ändern" ("The operation would change geometry 
type") and saving of the changings failes.


Following are the objects before and after the modification:

before editing:
wkt_geom: MultiPolygon (((379698.836953434 5709466.3700011175871, 379705.347671694 
5709460.9349959021807, 379703.797000204891 5709459.0760035017729, 379697.347813735 
5709464.7740020861626, 379698.836953434 5709466.3700011175871)))


after adding the point (379701.027186265 5709464.5429959766865):
wkt_geom: Polygon ((379701.027186265 5709464.5429959766865, 379705.347671694 
5709460.9349959021807, 379703.797000204891 5709459.0760035017729, 379697.347813735 
5709464.7740020861626, 379698.836953434 5709466.3700011175871, 379701.027186265 
5709464.5429959766865))


how can I make sure that the type does not change due to editing? The only idea i have is to remove or modify the 
geometry constraint in the Spatialite database table for the geometry column. The warning still appears but saving is 
successful.


Interesting fact: The problem didn't appear with QGIS 3.16.

Many thanks for your help!

Jörg Höttges

---
FH Aachen
University of Applied Sciences
Bayernallee 9
52066 Aachen | Germany
www.fh-aachen.de/menschen/hoettges



smime.p7s
Description: S/MIME Cryptographic Signature
___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer


[QGIS-Developer] SpatiaLite: SpatialIndex broken after trigger

2020-09-26 Thread Prof . Dr . Jörg Höttges

Hi,

There is a problem with the SpatialIndex and Triggers in SpatiaLite:

I have defined a trigger, that automaticly creates two geometry objects (geop: point object, geom: circle as multiline 
object), when a new dataset with attribute data is added to a table "schaechte".


After execution of an INSERT command you can see in QGIS the geometry objects only when no Spatial Index is created (see 
code below).


If I activate the CREATESPATIALINDEX command by uncommenting the respective line(s), the objects are not displayed in 
QGIS and the Spatial Index is broken after the insert executed by the trigger

SELECT CheckSpatialIndex('schaechte', 'geom') -->  0.

You can make them visible with:
SELECT RecoverSpatialIndex()

Does anybody know, why the SpatialIndex is broken after the INSERT command?

Here is the SQL-Code to be executed in the database window of QGIS or in 
SpatiaLiteGUI:

CREATE TABLE schaechte (
    pk INTEGER PRIMARY KEY,
    schnam TEXT,
    xsch REAL,
    ysch REAL,
    sohlhoehe REAL,
    deckelhoehe REAL,
    durchm REAL
);
SELECT AddGeometryColumn('schaechte','geop',25832,'POINT',2);
SELECT AddGeometryColumn('schaechte','geom',25832,'MULTIPOLYGON',2);
-- SELECT CreateSpatialIndex('schaechte', 'geop');-- geop objects are visible
SELECT CreateSpatialIndex('schaechte', 'geom');-- geom objects are not visible
CREATE TRIGGER IF NOT EXISTS create_missing_geoobject_schaechte
   AFTER INSERT ON schaechte FOR EACH ROW
    WHEN
    new.geom IS NULL AND
    new.geop IS NULL
    BEGIN
    UPDATE schaechte SET geop =
    MakePoint(new.xsch, new.ysch, 25832)
    WHERE schaechte.pk = new.pk;
    UPDATE schaechte SET geom =
CastToMultiPolygon(MakePolygon(MakeCircle(new.xsch, new.ysch,
    coalesce(new.durchm / 1000, 1), 25832)))
    WHERE schaechte.pk = new.pk;
    END;
INSERT INTO schaechte (schnam, xsch, ysch, sohlhoehe, deckelhoehe) VALUES
('D110036', 388798.830197, 5709945.16474, 79.51, 82.56),
('D110073', 388749.988968, 5709812.89315, 82.77, 85.47),
('D110074', 388709.61619, 5709930.66496, 80.82, 83.49),
('D110075', 388813.978304, 5709854.59264, 81.16, 84.09),
('D110076', 388809.473765, 5709888.00614, 80.49, 83.61);


Regards,

Jörg Höttges

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] pyqgis: editFormConfig.widgetConfig

2019-07-26 Thread Prof . Dr . Jörg Höttges
Hi all,

in a QGIS3 plugin I need to modify the editwidget from "TextEdit" to e. g. 
"ValueRelation". How can I find out the
Widgetname that I need for editFormConfig.widgetConfig(widgetname)? Or is this 
the wrong way to do it?

Thanks in advance

Jörg


FH Aachen   
Prof. Dr.-Ing. Jörg Höttges
Fachbereich 2 - Bauingenieurwesen
Wasserwirtschaft und Bauinformatik
Raum 02315
FH Aachen
University of Applied Sciences
Bayernallee 9
52066 Aachen | Germany
T +49 (0)241 6009-51176
F +49 (0)241 6009-51206
http://www.fh-aachen.de/hoettges/
hoett...@fh-aachen.de <mailto:hoett...@fh-aachen.de>

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Problem with Loading a new project file

2018-05-11 Thread Prof . Dr . Jörg Höttges
Hi,

I have a problem with loading a project file at the end of a python plugin:

    project = QgsProject.instance()
    project.read(QFileInfo(projectFile)) # read the new project file

Only a few layers are loaded, no styles etc. When I close the project and 
reload it manually, everthing is o.k.

How can I load the project file correctly?

Best wishes,

Jörg


FH Aachen   
Prof. Dr.-Ing. Jörg Höttges
Fachbereich 2 - Bauingenieurwesen
Wasserwirtschaft und Bauinformatik
FH Aachen
University of Applied Sciences
Bayernallee 9
52066 Aachen | Germany
T +49 (0)241 6009-51176
F +49 (0)241 6009-51206
http://www.fh-aachen.de/hoettges/
hoett...@fh-aachen.de <mailto:hoett...@fh-aachen.de>

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[QGIS-Developer] Problem reading project file

2017-05-05 Thread Jörg Höttges
Hi,

in a QGIS-plugin I need to read a template project file (*.qgs), modify it to 
adapt it to the currently loaded database
etc. using xml.etree.ElementTree, write it and read it again.




qgsxml.write(projectfile)   # writemodified project file

project = QgsProject.instance()
project.read(QFileInfo(projectfile)) # read the new project file

projectfilecontains the name of the new *.qgs projectfile

First attempt is successful, the second fails (groups are loaded but there are 
no layers), third attempt is successful,
fourth fails and so on...

Everything works fine when I use the menu "project > new" before starting the 
plugin.

Have i done something wrong?

Best wishes

Jörg

FH Aachen   
Prof. Dr.-Ing. Jörg Höttges
Fachbereich 2 - Bauingenieurwesen
Wasserwirtschaft und Bauinformatik
FH Aachen
University of Applied Sciences
Bayernallee 9
52066 Aachen | Germany
T +49 (0)241 6009-51176
F +49 (0)241 6009-51206
http://www.fh-aachen.de/hoettges/
hoett...@fh-aachen.de <mailto:hoett...@fh-aachen.de>

___
QGIS-Developer mailing list
QGIS-Developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer