libpysal icon indicating copy to clipboard operation
libpysal copied to clipboard

ENH: shared perimeter contiguity weighting.

Open ljwolf opened this issue 7 years ago • 7 comments

When we're coming from geodataframes, we can probably implement a shared perimeter weighting scheme pretty easily. This means that, instead of contiguity being a binary relation, we'd assign the weight to the adjacency graph according to how much of the polygon's perimeter is shared along their shared edge.

For Queen weights, this would necessarily reduce them down to Rook weights, so we would implement this only for Rook.

  1. do a first pass for binary contiguity
  2. for neighbors:
    1. poly_focal.intersection(poly_neighbor).length / poly_focal.boundary.length would give the asymmetric perimeter weight
    2. poly_focal.intersection(poly_neighbor).length / (poly_focal.boundary.length + poly_neighbor.length) would give a symmetrized perimeter weight

This would be an interesting addition to the library. It could be implemented as a function in util, and then applied at the end of initialisation for Rook.from_shapefile or from_dataframe if perimeter=True.

ljwolf avatar Jul 21 '18 18:07 ljwolf

this would also provide for proportional voting in lag_categorical

knaaptime avatar Jul 21 '18 19:07 knaaptime

do distance-based weights follow the same logic for area or do they just use centroids?

knaaptime avatar Jul 21 '18 19:07 knaaptime

we have this because @ljwolf added this code to segregation, so should we go ahead and move it here?

knaaptime avatar Jul 24 '19 20:07 knaaptime

@knaaptime any updates on this? I'd say yes, either import it from segregation & expose it here, or contribute the source here as weights.Proportional_Contiguity or something & import that into segregation

ljwolf avatar Jan 04 '20 19:01 ljwolf

imo it would be better to move it here and import into segregation so I'm happy to do that. Are we going to keep the Capital_Underscore convention or should I do lowercase_underscore with an eye toward adopting pep8 naming conventions in the future?

knaaptime avatar Jan 04 '20 20:01 knaaptime

Stale issue message

github-actions[bot] avatar Mar 05 '20 00:03 github-actions[bot]

Hi @knaaptime, this is implemented in Segregation, correct? That implementation needs to be kicked up here, not remain in segregation.

ljwolf avatar Aug 07 '20 15:08 ljwolf

lets move from here into lib asap

knaaptime avatar Jan 06 '23 18:01 knaaptime

xref #507

knaaptime avatar Dec 15 '23 18:12 knaaptime