Network.snapobservations(in_data, name, idvariable=None, attribute=None)[source]

Snap a point pattern shapefile to this network object. The point pattern is stored in the network.pointpattern[‘key’] attribute of the network object.

in_data : geopandas.GeoDataFrame or str

The input geographic data. Either (1) a path to a shapefile (str); or (2) a geopandas.GeoDataFrame.

name : str

Name to be assigned to the point dataset.

idvariable : str

Column name to be used as ID variable.

attribute : bool

Defines whether attributes should be extracted. True for attribute extraction. False for no attribute extraaction.


>>> import pysal.explore.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