b = geometry_name.load(filename);
The
Geometry.load function reads the file specified by the string expression
filename and stores the geometry data contained in the file in the
Geometry object named
geometry_name. The loaded geometry can be displayed on a map using
Map.addGeometry.
CSPro can load geometry from files in
GeoJSON format.
Loading very large GeoJSON files can be slow and may exceed the memory of the device. In some cases it may be necessary to break up large GeoJSON files into smaller files. For example, rather than using a single file containing geometry for an entire country, create smaller files for the geometry in each district and then load only the file for the district that the interviewer is currently working in. Alternatively, rather than using geometry you can save the vector data in a custom
base map.
The function returns a logical value of 1 (true) if the file was loaded and 0 (false) if the file could not be loaded.
// Declare a map
Map mymap;
// Load geometry from a file
Geometry boundary;
boundary.load("boundary.geojson");
// Add geometry to the map
mymap.addGeometry(boundary);
// Show the map
mymap.show();