Network.
snapobservations
(self, in_data, name, idvariable=None, attribute=None)[source]¶Snap a point pattern shapefile to network object. The
point pattern is stored in the network.pointpattern['key']
attribute of the network object.
The input geographic data. Either (1) a path to a
shapefile (str
); or (2) a geopandas.GeoDataFrame
.
Name to be assigned to the point dataset.
Column name to be used as ID variable.
Defines whether attributes should be extracted. True
for
attribute extraction. False
for no attribute extraction.
Examples
>>> import spaghetti as spgh
>>> streets_file = examples.get_path('streets.shp')
>>> ntw = spgh.Network(in_data=streets_file)
>>> pt_str = 'crimes'
>>> in_data = examples.get_path('{}.shp'.format(pt_str))
>>> ntw.snapobservations(in_data, pt_str, attribute=True)
>>> ntw.pointpatterns[pt_str].npoints
287