Map Section¶
For this example we create a borehole and output it in PNG. We assume that we have a feature class with name “area1” that has some TIN features.
Getting the feature ids
We can get them from a feature class like so.
feature_classes = ni.list_feature_classes()
area1_feature_class = next((fc for fc in feature_classes
if fc.name == "area1"))
area1_features = ni.list_features(area1_feature_class)
Or we could get them from a MoMa node like in the following example.
List all child feature ids of a MoMa Node
Setting up the input parameters
map_rect = GSTPy.Rectangle2d(
GSTPy.Point2d(5398872, 5667584),
GSTPy.Point2d(5397630, 5671038),
width=5000)
srs = area1_feature_class.srs
input_params = GSTPy.MapImageParameters(area1_feature_ids, map_rect, srs)
Setting up the output parameters
# input parameters
map_rect = GSTPy.Rectangle2d(
GSTPy.Point2d(5398872, 5667584),
GSTPy.Point2d(5397630, 5671038),
width=5000)
srs = area1_feature_class.srs
input_params = GSTPy.MapImageParameters(area1_feature_ids, map_rect, srs)
# output parameters
output_path = r"D:\temp\isec\output"
output_params = GSTPy.OutputShapeParameters(output_path)
Performing the intersection
output_zip_name = ni.save_map_section_shape(input_params, output_params)
Full code sample
import GSTPy
# getting the feature ids
feature_classes = ni.list_feature_classes()
area1_feature_class = next((fc for fc in feature_classes
if fc.name == "area1"))
area1_features = ni.list_features(area1_feature_class)
area1_feature_ids = [f.feature_id for f in area1_features]
# input parameters
map_rect = GSTPy.Rectangle2d(
GSTPy.Point2d(5398872, 5667584),
GSTPy.Point2d(5397630, 5671038),
width=5000)
srs = area1_feature_class.srs
input_params = GSTPy.MapImageParameters(area1_feature_ids, map_rect, srs)
# output parameters
output_path = r"D:\temp\isec\output"
output_params = GSTPy.OutputShapeParameters(output_path)
# intersection
output_zip_name = ni.save_map_section_shape(input_params, output_params)