danioxoli / HotSpotAnalysis_Plugin

A QGIS plugin for hotspot analysis
GNU General Public License v3.0
56 stars 13 forks source link

wgs point fdb function #43

Open Ariel505 opened 4 years ago

Ariel505 commented 4 years ago

Hello, I use a wgs84 point shapefile as input, and give a distance band in meters. Please find the dataset for testing here: https://drive.google.com/file/d/1EzE8hHZaL7HrtunXboFDrrSAzi_UOYav/view?usp=sharing

Field for analysis: SUMME Fixed Distance Band: 3500 method: Local Getis-Ord G*

The result shapefile produces lots of inf, -inf, nan in Z-sore, 0 in p-value. Is that possible to not project the point dataset before hotspot analysis? Cheers, Ariel

danioxoli commented 4 years ago

Dear Ariel,

the answer is no unless you select an alternative weighting schema (i.e.Knn.).

The pysal distance band weighting function does not support the automatic conversion between geographic and projected coordinates. Therefore the distance band in the plugin has to be expressed as an integer number representing meters (or feet) depending on the projection you adopt.

By projecting your points in WGS-UTM32N (EPSG:32632) everything should work (be careful that 3500 m is not enough to ensure at least one neighbor to each point in your case)

Best,

Daniele

Ariel505 commented 4 years ago

Thank you Daniele, There is no problem for me to reproject the dataset. So after I project this point dataset into EPSG:25832, I got another strange OGR error: File "C:/Users/hud219/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 635, in run y, threshold1) File "C:/Users/hud219/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\HotspotAnalysis\hotspot_analysis.py", line 359, in write_file outFeature.SetField(outLayerDefn.GetFieldDefn(j).GetNameRef(), inFeature.GetField(j)) File "C:\OSGeo4W\apps\Python37\lib\site-packages\osgeo\ogr.py", line 4458, in SetField return _ogr.Feature_SetFieldString(self, fld_index, args[1]) RuntimeError: not a string

Here are parameters I used. FDB: 3600 Field: dif_G input dataset: inputpoint.zip

Do you maybe know which part went wrong?

Thanks!

Ariel

danioxoli commented 4 years ago

Actually, I get no error in replicating what you are suggesting:

immagine

It seems from the log that there was an issue with the output file name. Try to use a different one...

However, I notice that on QGIS 3.4 this computation takes a lot of time. I hope soon to find time to switch on PySAL 2 and improve the general performances of the plugin which is getting old!

Thank you for your interest.

Best,

Daniele

Ariel505 commented 4 years ago

Hi Daniele, Great, looking forward to migrate to PySAL 2 - I still have PySAL 1.14.4.post2 installed. I just realized the script failed at character encoding, it was in ISO-8859-1. Is there possible to change your code in 359 to adapt any encoding characters of shapefiles? Cheers, Ariel