Questions tagged [pysal]

Pysal is a spatial analysis library written in Python. It provides a variety of functions for interpreting common spatial data file formats and performing common analyses on them, with the goal of being easy to providing core functionality that is easier to integrate into higher level projects.

Pysal is an open-source library of spatial data analysis tools written in Python. It is able to read a variety of common data file formats such as shapefiles, DBF, CSV, WKT, GeoDa, GAL, GWT, and files from popular programs such as ArcGIS, MATLAB, and Stata. It provides functions for assessing autocorrelation, spatial econometrics, analyzing spatial data over time and more.

68 questions
2
votes
2 answers

Is there an add on for the pysal library for generating a queen contiguity?

I am trying to perform a spatial autocorrelation function on a shapefile(shp). How do i generate a queen contiguity for this? I read the pysal documentation and saw the 'queen_from_shapefile' but I get an error. This is my code: shp=…
John_gis
  • 117
  • 8
2
votes
1 answer

How to define colors of Lisa cluster manually?

I am trying to do some maps of LISA CLUSTERS. O changed the code of lisa_cluster function to specify the colors I wanted. I used a generic 5 colors list, and changed it manually from matplotlib import patches, colors import…
Oalvinegro
  • 458
  • 5
  • 21
2
votes
0 answers

How to fix "TypeError: ('must be real number, not numpy.str_', 'occurred at index 0')" error in python

I am trying to apply the function get_complaint_count to my entire data frame called 'treeLocations', which contains x and y coordinate values in individual columns. However, I can't apply the function to the entire dataframe. I don't understand…
Naiem
  • 71
  • 1
  • 5
2
votes
1 answer

Python: how to compute the spatial autocorrelation of indicators from a shapefile?

I am using geopandas to read the shapefile of municipalities of Switzerland, i.e municipalities.shp. For 170 I have the info of the population, i.e. population.csv The files from can be found in this repo here. Is it possible to merge the…
emax
  • 6,965
  • 19
  • 74
  • 141
2
votes
2 answers

Python - How do I compute interactive spatial autocorrelation (Moran I) using PySAL?

I have a points table my_table my in PostgreSQL database with geometry column and other attributes. I have some sample data of my_table like follows (attributes of my_table). id val1 1 72.54513286 2 73.67371014 3 74.204424 4 73.76017279 5 …
khajlk
  • 791
  • 1
  • 12
  • 32
2
votes
2 answers

Pysal doesn't recognize some polygon neighbors

I'm using the Pysal tool for analyzing several shapefiles (type polygon) that contain the results of segmentations done in QGIS. I load the shapefile using segshp = pysal.weights.Queen.from_shapefile(vect) being vect the name of the corresponding…
2
votes
1 answer

Saving full QUEEN neighbor array to CSV in Pysal (Census Block Groups)

Let me start by saying, other than a stata .do file and some MCMC in R, I haven't coded since an AOL warez group application in VB; so I apologize for being here messin with y'all to begin with. I am writing an environmental justice paper working…
2
votes
2 answers

Tokenising integers in a string

I have a text file containing coordinates in the form of: [-1.38795678, 54.90352965] [-3.2115, 55.95530556] [0.00315428, 51.50285246] I want to be able to iterate through each coordinate to check which polygon it is in (UK counties in a…
JTH
  • 445
  • 1
  • 5
  • 8
2
votes
1 answer

How to use Shapefile in Pysal

I want result of the points intersecting in the given polygon, but I am getting an error. My code is: from pysal.cg.standalone import…
AlphabateCoder
  • 95
  • 2
  • 11
1
vote
0 answers

Clipping Voronoi vessels (pysal.cg.voronoi)

straight to the problem: given these points [[ 77.51 254.19], [ 75.32 184.45], [ 88.57 83.43], [153. 135. ], [196.62 55.78]] and a polygon that defines the bounding box, which should be covered entirely by voronoi tessels: [230 0; 230 370; 0…
1
vote
0 answers

legend color doesn't match map colors python

I'm using the vba_choropleth to create Value-by-Alpha Choropleth, but the legend doesn't match the color of my map. fig = plt.figure(figsize=(15,10)) ax = fig.add_subplot(111) vba_choropleth(x, y, gdf, …
Sunflower
  • 53
  • 5
1
vote
1 answer

how solve this problem with import pysal in conda?

I installed pysal in conda with pyton 3.7(conda install -c conda-forge pysal),but I try to import it and I get this error: runfile('D:/2019-1/Cartografia Geotecnica/Talleres&cod/loco.py', wdir='D:/2019-1/Cartografia…
1
vote
0 answers

Python: error while I try to update pysal

I have pysal1.4.1 installed on Python3.7.3 trough pip. If I try to update it sudo pip install pysal --upgrade I get the following error ERROR: Command errored out with exit status 1: command: /usr/local/opt/python/bin/python3.7 -c 'import…
emax
  • 6,965
  • 19
  • 74
  • 141
1
vote
1 answer

Error while import plot_spatial_weights in Python

I am trying to import plot_spatial_weights from pysal.viz.splot.libpysal this what I am doing from pysal.viz.splot.libpysal import plot_spatial_weights and I get the error ModuleNotFoundError: No module named 'pysal.viz'
emax
  • 6,965
  • 19
  • 74
  • 141
1
vote
1 answer

How to fix colors of LISA Cluster maps from Pysal

I am using the LISA Cluster package from Pysal to create a LISA (Local Indicator of Spatial Autocorrelation) map. As the example of the documentation shows, the color lightblue is used to identify regions classified as "Low-High" The problem is…
Oalvinegro
  • 458
  • 5
  • 21