# Tag Info

Accepted

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

Check out PySAL: The Python Spatial Analysis Library https://pysal.readthedocs.io/en/latest/
• 1,956
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 ...
• 31.9k

### 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....
• 309

### 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") ...
• 29.9k

### 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 ...
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', ...
• 350

### 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 ...
• 42.1k
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/...
• 131

### 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 ...
• 283
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....
• 55k

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 ...
• 55k
Accepted

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

This can be accomplished using higher order weights.
• 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 ...
• 36
1 vote

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])
• 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 ...
• 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 ...
• 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 ...
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 ...
• 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 ...
• 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 ...
• 31.9k

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