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 shapefile.
The problem is that when I look in the neighbors dictionary, if a polygon shares less than 2 pixels it is not considered a neighbor. Let me show a bit better:
Using ArcGIS, I calculate the polygon neighbors (Analysis tools --> Proximity ---> Polygon neighbors), and for example, polygon 1227 has 4 neighbors as shown in the image.
Neighbors calculated with ArcGIS
But when loading in Python using Pysal, polygon 1227 has only 3 neighbors and the one missing is 3307, which only shares a 2 pixel border. Same happens with other polygons that share only 1 or 2 pixels. This "threshold" of 2 pixels is just what I have seen analyzing some polygons.
Neighbors calculated with Pysal
Is there anyway of changing that "threshold" in order to consider all neighbors? i've seen in the Pysal documentation and thought maybe it's related to the command
pysal.weights.user.min_threshold_dist_from_shapefile
or something similar, but honestly I got no idea.
I also tried with the pysal.weights.Rook... option, but it recognizes less neighbors and finds more islands.
Thanks a lot