Parses input_string with vtkGeoJSONReader, returns vtkPolyData feature_properties is a dictionary of name-default_values to attach as cell data in the returned vtkPolyData.
(input_string, feature_properties={})
| 8 | from vtkmodules.vtkIOGeoJSON import vtkGeoJSONReader |
| 9 | |
| 10 | def load_geojson(input_string, feature_properties={}): |
| 11 | '''Parses input_string with vtkGeoJSONReader, returns vtkPolyData |
| 12 | |
| 13 | feature_properties is a dictionary of name-default_values |
| 14 | to attach as cell data in the returned vtkPolyData. |
| 15 | ''' |
| 16 | reader = vtkGeoJSONReader() |
| 17 | #reader.DebugOn() |
| 18 | reader.StringInputModeOn() |
| 19 | reader.SetStringInput(input_string) |
| 20 | for name,default_value in feature_properties.items(): |
| 21 | reader.AddFeatureProperty(name, default_value) |
| 22 | reader.Update() |
| 23 | return reader.GetOutput() |
| 24 | |
| 25 | |
| 26 | if __name__ == '__main__' : |
no test coverage detected