MCPcopy Create free account
hub / github.com/Kitware/VTK / load_geojson

Function load_geojson

IO/GeoJSON/Testing/Python/TestGeoJSONReader.py:10–23  ·  view source on GitHub ↗

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={})

Source from the content-addressed store, hash-verified

8from vtkmodules.vtkIOGeoJSON import vtkGeoJSONReader
9
10def 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
26if __name__ == '__main__' :

Callers 1

Calls 5

vtkGeoJSONReaderFunction · 0.85
AddFeaturePropertyMethod · 0.80
itemsMethod · 0.45
UpdateMethod · 0.45
GetOutputMethod · 0.45

Tested by

no test coverage detected