Skip to main content
9 votes
Accepted

Getis-Ord Gi* (arcgis 'hotspot analysis') with python?

Check out PySAL: The Python Spatial Analysis Library https://pysal.readthedocs.io/en/latest/
Charlie Parr's user avatar
  • 1,956
5 votes
Accepted

Compute Moran's I on more than one attribute

One does have to question the why here. What do you hope to achieve in evaluating multivariate autocorrelation? What hypothesis are you, in fact, testing? If this is in the context of a linear ...
Jeffrey Evans's user avatar
5 votes

Moran's I on 2D arrays/rasters?

Eventually, with the help of Serge Rey's answer and this link in the documentation, I ended up using pysal's implementation as follows: import pysal as ps w = ps.lat2W(input_img.shape[0],input_img....
GStav's user avatar
  • 309
3 votes

Read specific columns shapefile with PySAL

Suppose you have a shapefile named cities.shp. In order to read the attribute table, you need to read .dbf where the attributes are stored. import pysal as ps dbf = ps.open(r"C:\GIS\Temp\cities.dbf") ...
Alex Tereshenkov's user avatar
3 votes

Adding python module to QGIS python interpreter on mac?

The link to a previous question @underdark posted in her comment pointed me in the right direction. The only thing not detailed there is the syntax needed to pick between two different python 2 ...
Aidian Holder's user avatar
3 votes
Accepted

Spatial weight for PySAL from a geojson file or geodataframe?

First, let us try to create a Minimal, Complete, and Verifiable example geoj = { 'type': 'FeatureCollection', 'features': { 'type': 'Feature', 'geometry': { 'type': 'Polygon', ...
keepAlive's user avatar
  • 350
3 votes

PySal and PostGIS (maybe via Shapely). How can these two interact?

The quickest way is to keep the geometry in hex-encoded WKB. import psycopg2 from shapely import wkb conn = psycopg2.connect('...') curs = conn.cursor() shps = {} # key: gid, value: Shapely geom ...
Mike T's user avatar
  • 42.1k
3 votes
Accepted

Moran's I on 2D arrays/rasters?

If the raster has r rows and c columns, then you can create a pysal W object with: w = pysal.lat2W(r,c) and use that with the Moran class. More details available at: https://pysal.org/libpysal/...
Serge Rey's user avatar
  • 131
2 votes

Using PySAL to perform Hot/Cold Spots

To determine hotspots and coldspots, you first need to see globally if there exists some form of autocorrelation/clustering (Global Moran's I). Then, you could do local statistics to determine local ...
meteo_96's user avatar
  • 283
2 votes
Accepted

PySal and PostGIS (maybe via Shapely). How can these two interact?

The easiest solution is to get a dictionary from query (psycopg2.extras: Real dictionary cursor or Dictionary-like cursor ) and the GeoJson format (ST_AsGeoJSON) import psycopg2 conn = psycopg2....
gene's user avatar
  • 55k
2 votes

Read shapefile into pysal

Whith Pysal or libpysal you don't need geopandas to read a point shapefile import libpysal from pointpats import PointPattern shp = libpysal.io.open('point.shp') pp = PointPattern((pt[0],pt[1]) for ...
gene's user avatar
  • 55k
2 votes
Accepted

Is it possible to compute higher order queens contiguity in PySAL?

This can be accomplished using higher order weights.
Serge Rey's user avatar
  • 131
1 vote
Accepted

How to interpret spatial random permutations against the observed value of the statistic (PySAL)

The idea behind the permutation is the following: Under the null there is no spatial correlation in the data. A way of creating patterns of no spatial correlation (or complete spatial randomness to ...
Akis's user avatar
  • 36
1 vote

Read shapefile into pysal

You can use geopandas import geopandas as gpd from pointpats import PointPattern gdf = gpd.read_file('points.shp') pp = PointPattern([[p.x, p.y] for p in gdf.geometry])
user2856's user avatar
  • 66.4k
1 vote
Accepted

interpretation of Global Moran I values using pysal

To answer the last question, I generally use GeoDA software to calculate the Moran's I (and by extension the local indicators of spatial autocorrelation [LISA]). This software does calculate a ...
Atm's user avatar
  • 1,537
1 vote

Python equivalent of spatstat's spatial point process functions

I was just doing some research on this question. spatstats in PySAL looks like the best bet to me AstroPy has implemented Ripley's K It is also possible to run R code from Python using rmagic / rpy2 ...
atkat12's user avatar
  • 1,549
1 vote

Where to find PySAL toolbox for ArcGIS?

The most current version of this project is on github: https://github.com/Esri/PySAL-ArcGIS-Toolbox We are in the process of updating the install documentation and creating a homepage for the ...
Mark Janikas's user avatar
1 vote

Error while running PySAL SpaceTimeEvents function

Summary: You can fix this by changing one line of code but I also will do a pull request for the pysal library to make sure no one else has the issue in the future. Details: The problem is line 124 ...
Linwoodc3's user avatar
  • 111
1 vote

Find maximum theoretical join count (spatial statistics)

the theoretical maximum of a join is given by the Cartesian product of the sets. That's literally what CROSS JOIN does it gives you the maximum-join which you reduce later. SELECT * FROM ...
Evan Carroll's user avatar
  • 7,081
1 vote

Using R to do logistic geographically weighted regression(GWR) prediction

Is the gwmodel$SDF object not populated? The model object should contain a SpatialPixelsDataFrame object with the model estimates. It is very difficult to provide advice when you do not show us what ...
Jeffrey Evans's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible