On Fri, 8 Jan 2021, Sven Schreiber wrote:
Am 08.01.2021 um 15:22 schrieb Stefano:
> I have a little feature request inspired by the new geomapping function.
> Assume a spatial dataset including info from a shape file. Now we can
> easily produce maps, but to carry out spatial autocorrelation and
> spatial regression analysis we need a spatial weight matrix. Considering
> that all the coordinates info is included in the shape files, it would
> be nice to be able to recover the coordinates of the centroids of the
> units as an extra pair of variables. Then distance-based spatial weight
> matrices can be easily constructed by the user with his preferred
> formula (or using a contributed function taking the series with the
> coordinates as inputs - I can volunteer for that, it'd be at most 10
> lines of code :-) )
> bye
> Stefano
Hi, I like the idea but at first sight it looks like a job for a
(contributed) hansl function (package). Also, what's the consensus way
of deriving the "centroid" from a polygon?
Yep, nice idea. Unfortunately one further difficulty: the
geographical units of interest in a geojson or shape file may be
composed of multiple polygons. However, I think the existing
function geoplot_translate_feature() in geoplot.inp might contain
some helpful code.
Allin