arcgis 0.1.3

Type-safe Rust SDK for the ArcGIS REST API with compile-time guarantees
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
//! Elevation service client implementation.

use crate::{ArcGISClient, ErrorKind, FeatureSet, GPExecuteResult, Result};
use tracing::instrument;

use super::types::{
    ProfileParameters, ProfileResult, SummarizeElevationParameters, SummarizeElevationResult,
    ViewshedParameters, ViewshedResult,
};

/// Client for interacting with ArcGIS Elevation Services.
///
/// The Elevation Service provides terrain analysis operations including
/// elevation profiles, statistics, and viewshed analysis.
///
/// # Example
///
/// ```no_run
/// use arcgis::{ApiKeyAuth, ArcGISClient, ElevationClient, ProfileParametersBuilder};
///
/// # async fn example() -> arcgis::Result<()> {
/// let auth = ApiKeyAuth::new("YOUR_API_KEY");
/// let client = ArcGISClient::new(auth);
/// let elevation = ElevationClient::new(&client);
///
/// // Get elevation profile along a line (FeatureSet JSON with a polyline)
/// let line_features = r#"{"geometryType":"esriGeometryPolyline","features":[{"geometry":{"paths":[[[-120,40],[-119,41]]]}}],"spatialReference":{"wkid":4326}}"#;
/// let params = ProfileParametersBuilder::default()
///     .input_line_features(line_features)
///     .dem_resolution("30m")
///     .build()
///     .expect("Valid parameters");
///
/// let result = elevation.profile(params).await?;
/// # Ok(())
/// # }
/// ```
#[derive(Clone)]
pub struct ElevationClient<'a> {
    /// Base URL of the elevation service.
    url: String,

    /// Reference to the ArcGIS client.
    client: &'a ArcGISClient,
}

impl<'a> ElevationClient<'a> {
    /// Creates a new elevation service client.
    ///
    /// # Arguments
    ///
    /// * `client` - Reference to an [`ArcGISClient`] for making requests
    ///
    /// Uses the default ArcGIS Online Elevation Service URL.
    ///
    /// # Example
    ///
    /// ```no_run
    /// use arcgis::{ApiKeyAuth, ArcGISClient, ElevationClient};
    ///
    /// let auth = ApiKeyAuth::new("YOUR_API_KEY");
    /// let client = ArcGISClient::new(auth);
    /// let elevation = ElevationClient::new(&client);
    /// ```
    pub fn new(client: &'a ArcGISClient) -> Self {
        ElevationClient {
            url: "https://elevation.arcgis.com/arcgis/rest/services/Tools/ElevationSync/GPServer"
                .to_string(),
            client,
        }
    }

    /// Creates a new elevation service client with a custom URL.
    ///
    /// # Arguments
    ///
    /// * `url` - Base URL of the elevation service
    /// * `client` - Reference to an [`ArcGISClient`] for making requests
    ///
    /// # Example
    ///
    /// ```no_run
    /// use arcgis::{ApiKeyAuth, ArcGISClient, ElevationClient};
    ///
    /// let auth = ApiKeyAuth::new("YOUR_API_KEY");
    /// let client = ArcGISClient::new(auth);
    /// let elevation = ElevationClient::with_url(
    ///     "https://custom-elevation.example.com/GPServer",
    ///     &client
    /// );
    /// ```
    pub fn with_url(url: impl Into<String>, client: &'a ArcGISClient) -> Self {
        ElevationClient {
            url: url.into(),
            client,
        }
    }

    /// Generates an elevation profile along a line or points.
    ///
    /// Returns elevation values sampled along the input geometry,
    /// useful for creating cross-sections and elevation transects.
    ///
    /// # Arguments
    ///
    /// * `params` - Profile parameters (geometry, resolution, etc.)
    ///
    /// # Returns
    ///
    /// Profile result containing elevation data along the line.
    ///
    /// # Example
    ///
    /// ```no_run
    /// use arcgis::{ApiKeyAuth, ArcGISClient, ElevationClient, ProfileParametersBuilder};
    ///
    /// # async fn example() -> arcgis::Result<()> {
    /// let auth = ApiKeyAuth::new("YOUR_API_KEY");
    /// let client = ArcGISClient::new(auth);
    /// let elevation = ElevationClient::new(&client);
    ///
    /// let line_features = r#"{"geometryType":"esriGeometryPolyline","features":[{"geometry":{"paths":[[[-120.5,38.5],[-120.0,39.0]]]}}],"spatialReference":{"wkid":4326}}"#;
    /// let params = ProfileParametersBuilder::default()
    ///     .input_line_features(line_features)
    ///     .dem_resolution("30m")
    ///     .build()
    ///     .expect("Valid parameters");
    ///
    /// let result = elevation.profile(params).await?;
    ///
    /// tracing::info!(
    ///     point_count = result.output_profile().features().len(),
    ///     "Elevation profile generated"
    /// );
    /// # Ok(())
    /// # }
    /// ```
    #[instrument(skip(self, params))]
    pub async fn profile(&self, params: ProfileParameters) -> Result<ProfileResult> {
        tracing::debug!("Generating elevation profile");

        let profile_url = format!("{}/Profile/execute", self.url);

        let mut request = self
            .client
            .http()
            .get(&profile_url)
            .query(&[("f", "json")])
            .query(&params);

        if let Some(token) = self.client.get_token_if_required().await? {
            request = request.query(&[("token", token)]);
        }

        tracing::debug!(url = %profile_url, "Sending profile request");

        let response = request.send().await?;
        let response_body = response.text().await?;

        tracing::debug!(
            response_length = response_body.len(),
            response_body = %response_body,
            "Received profile response"
        );

        let gp_result: GPExecuteResult = serde_json::from_str(&response_body)?;

        tracing::debug!(
            result_count = gp_result.results().len(),
            message_count = gp_result.messages().len(),
            "Parsed GP execute result"
        );

        // Extract the OutputProfile FeatureSet from the GP result
        let output_param = gp_result.results().first().ok_or_else(|| {
            tracing::error!("GP result missing results array");
            crate::Error::from(ErrorKind::Api {
                code: 0,
                message: "Elevation profile result missing results array".to_string(),
            })
        })?;

        tracing::debug!(
            param_name = ?output_param.param_name(),
            data_type = ?output_param.data_type(),
            "Extracting profile parameter"
        );

        let feature_set_value = output_param.value().as_ref().ok_or_else(|| {
            tracing::error!("OutputProfile parameter missing value");
            crate::Error::from(ErrorKind::Api {
                code: 0,
                message: "Elevation profile parameter missing value field".to_string(),
            })
        })?;

        let feature_set: FeatureSet = serde_json::from_value(feature_set_value.clone())?;

        tracing::debug!(
            feature_count = feature_set.features().len(),
            geometry_type = ?feature_set.geometry_type(),
            "Extracted profile FeatureSet"
        );

        let result = ProfileResult::new(feature_set);

        tracing::debug!("Profile generated");

        Ok(result)
    }

    /// Submits an asynchronous SummarizeElevation job.
    ///
    /// Computes elevation, slope, and aspect statistics for input features.
    /// Returns a job ID that can be used to poll for completion.
    ///
    /// # Arguments
    ///
    /// * `params` - Summarize parameters (features, resolution, etc.)
    ///
    /// # Returns
    ///
    /// Job information including job ID and initial status.
    ///
    /// # Example
    ///
    /// ```no_run
    /// use arcgis::{ApiKeyAuth, ApiKeyTier, ArcGISClient, ElevationClient, SummarizeElevationParametersBuilder, DemResolution};
    ///
    /// # async fn example() -> arcgis::Result<()> {
    /// let auth = ApiKeyAuth::agol(ApiKeyTier::Location)?;
    /// let client = ArcGISClient::new(auth);
    /// let elevation = ElevationClient::new(&client);
    ///
    /// let polygon = r#"{"geometryType":"esriGeometryPolygon","spatialReference":{"wkid":4326},"features":[{"geometry":{"rings":[[[-119.5,37.8],[-119.4,37.8],[-119.4,37.9],[-119.5,37.9],[-119.5,37.8]]]},"attributes":{"OID":1}}]}"#;
    ///
    /// let params = SummarizeElevationParametersBuilder::default()
    ///     .input_features(polygon)
    ///     .dem_resolution(DemResolution::ThirtyMeter.as_str())
    ///     .include_slope_aspect(true)
    ///     .build()
    ///     .expect("Valid parameters");
    ///
    /// let job = elevation.submit_summarize_elevation(params).await?;
    /// tracing::info!(job_id = %job.job_id(), "Job submitted");
    /// # Ok(())
    /// # }
    /// ```
    #[instrument(skip(self, params))]
    pub async fn submit_summarize_elevation(
        &self,
        params: SummarizeElevationParameters,
    ) -> Result<crate::GPJobInfo> {
        tracing::debug!("Submitting SummarizeElevation job");

        // Create GP service client for async Elevation service
        let gp_service = crate::GeoprocessingServiceClient::new(
            "https://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/SummarizeElevation",
            self.client,
        );

        // Convert params to HashMap
        let param_map = self.params_to_hashmap(&params)?;

        // Submit job
        let job = gp_service.submit_job(param_map).await?;

        tracing::info!(
            job_id = %job.job_id(),
            status = ?job.job_status(),
            "SummarizeElevation job submitted"
        );

        Ok(job)
    }

    /// Polls a SummarizeElevation job until completion and returns the typed result.
    ///
    /// This is a convenience method that combines status polling with result extraction.
    ///
    /// # Arguments
    ///
    /// * `job_id` - Job identifier from `submit_summarize_elevation`
    /// * `timeout_ms` - Optional timeout in milliseconds (default: 60000)
    ///
    /// # Returns
    ///
    /// Typed result containing elevation statistics.
    ///
    /// # Example
    ///
    /// ```no_run
    /// # use arcgis::{ApiKeyAuth, ApiKeyTier, ArcGISClient, ElevationClient, SummarizeElevationParametersBuilder};
    /// # async fn example() -> arcgis::Result<()> {
    /// # let auth = ApiKeyAuth::agol(ApiKeyTier::Location)?;
    /// # let client = ArcGISClient::new(auth);
    /// # let elevation = ElevationClient::new(&client);
    /// # let polygon = r#"{"geometryType":"esriGeometryPolygon","spatialReference":{"wkid":4326},"features":[{"geometry":{"rings":[[[-119.5,37.8],[-119.4,37.8],[-119.4,37.9],[-119.5,37.9],[-119.5,37.8]]]},"attributes":{"OID":1}}]}"#;
    /// # let params = SummarizeElevationParametersBuilder::default().input_features(polygon).build().expect("Valid");
    /// # let job = elevation.submit_summarize_elevation(params).await?;
    /// let result = elevation.poll_summarize_elevation(job.job_id(), None).await?;
    ///
    /// if let Some(mean) = result.mean_elevation() {
    ///     tracing::info!(elevation_m = mean, "Mean elevation");
    /// }
    /// # Ok(())
    /// # }
    /// ```
    #[instrument(skip(self), fields(job_id, timeout_ms))]
    pub async fn poll_summarize_elevation(
        &self,
        job_id: &str,
        timeout_ms: Option<u64>,
    ) -> Result<SummarizeElevationResult> {
        tracing::debug!("Polling SummarizeElevation job");

        let gp_service = crate::GeoprocessingServiceClient::new(
            "https://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/SummarizeElevation",
            self.client,
        );

        // Poll until complete
        let job_info = gp_service
            .poll_until_complete(job_id, 2000, 5000, timeout_ms.or(Some(60000)))
            .await?;

        tracing::debug!(
            job_id = %job_info.job_id(),
            status = ?job_info.job_status(),
            "Job completed"
        );

        // Extract result from GP response
        self.extract_summarize_result(&job_info).await
    }

    /// Helper to convert typed params to HashMap for GP service.
    fn params_to_hashmap<T: serde::Serialize>(
        &self,
        params: &T,
    ) -> Result<std::collections::HashMap<String, serde_json::Value>> {
        use std::collections::HashMap;

        let json_value = serde_json::to_value(params)?;
        let map = json_value
            .as_object()
            .ok_or_else(|| crate::BuilderError::new("Failed to convert params to map"))?
            .iter()
            .map(|(k, v)| (k.clone(), v.clone()))
            .collect::<HashMap<String, serde_json::Value>>();
        Ok(map)
    }

    /// Helper to extract SummarizeElevationResult from GP job info.
    async fn extract_summarize_result(
        &self,
        job_info: &crate::GPJobInfo,
    ) -> Result<SummarizeElevationResult> {
        tracing::debug!("Extracting SummarizeElevation result from GP response");

        // Get results map
        let results = job_info.results();

        // Log all available result parameters
        tracing::debug!(
            result_count = results.len(),
            result_keys = ?results.keys().collect::<Vec<_>>(),
            "Available result parameters"
        );

        // Get OutputSummary parameter
        let output_summary_param = results.get("OutputSummary").ok_or_else(|| {
            tracing::error!("Results missing OutputSummary parameter");
            crate::Error::from(ErrorKind::Api {
                code: 0,
                message: "SummarizeElevation result missing OutputSummary parameter".to_string(),
            })
        })?;

        // Get the value - either directly or by fetching from paramUrl
        let output_summary = if let Some(value) = output_summary_param.value() {
            // Value is directly available
            tracing::debug!("Using OutputSummary value from inline response");
            value.clone()
        } else if let Some(param_url) = output_summary_param.param_url() {
            // Need to fetch from URL
            tracing::debug!(param_url = %param_url, "Fetching OutputSummary from paramUrl");

            // Create GP client to fetch the result
            let gp_service = crate::GeoprocessingServiceClient::new(
                "https://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/SummarizeElevation",
                self.client,
            );

            // Fetch the result data
            let result_json = gp_service
                .get_result_data(job_info.job_id(), "OutputSummary")
                .await?;

            // Extract the "value" field which contains the actual FeatureSet
            result_json
                .get("value")
                .ok_or_else(|| {
                    tracing::error!("Result data missing 'value' field");
                    crate::Error::from(ErrorKind::Api {
                        code: 0,
                        message: "OutputSummary result data missing 'value' field".to_string(),
                    })
                })?
                .clone()
        } else {
            tracing::error!("OutputSummary parameter has neither value nor paramUrl");
            return Err(crate::Error::from(ErrorKind::Api {
                code: 0,
                message: "OutputSummary parameter has no value or paramUrl".to_string(),
            }));
        };

        // Parse as FeatureSet
        let feature_set: FeatureSet = serde_json::from_value(output_summary.clone())?;

        tracing::debug!(
            feature_count = feature_set.features().len(),
            "Parsed OutputSummary FeatureSet"
        );

        // Extract statistics from feature attributes
        let result = SummarizeElevationResult::from_feature_set(&feature_set).map_err(|e| {
            crate::Error::from(ErrorKind::Api {
                code: 0,
                message: format!("Failed to parse elevation statistics: {}", e),
            })
        })?;

        Ok(result)
    }

    /// Submits an asynchronous Viewshed job.
    ///
    /// Determines visible areas from observer points based on terrain.
    /// Returns a job ID that can be used to poll for completion.
    ///
    /// # Arguments
    ///
    /// * `params` - Viewshed parameters (observer points, distance, height, etc.)
    ///
    /// # Returns
    ///
    /// Job information including job ID and initial status.
    ///
    /// # Example
    ///
    /// ```no_run
    /// use arcgis::{ApiKeyAuth, ApiKeyTier, ArcGISClient, ElevationClient, ViewshedParametersBuilder, DemResolution};
    ///
    /// # async fn example() -> arcgis::Result<()> {
    /// let auth = ApiKeyAuth::agol(ApiKeyTier::Location)?;
    /// let client = ArcGISClient::new(auth);
    /// let elevation = ElevationClient::new(&client);
    ///
    /// let observer = r#"{"geometryType":"esriGeometryMultipoint","spatialReference":{"wkid":4326},"points":[[-119.5,37.85]]}"#;
    ///
    /// let params = ViewshedParametersBuilder::default()
    ///     .input_points(observer)
    ///     .maximum_distance(5000.0)
    ///     .maximum_distance_units("Meters")
    ///     .observer_height(1.75)
    ///     .dem_resolution(DemResolution::ThirtyMeter.as_str())
    ///     .build()
    ///     .expect("Valid parameters");
    ///
    /// let job = elevation.submit_viewshed(params).await?;
    /// tracing::info!(job_id = %job.job_id(), "Job submitted");
    /// # Ok(())
    /// # }
    /// ```
    #[instrument(skip(self, params))]
    pub async fn submit_viewshed(&self, params: ViewshedParameters) -> Result<crate::GPJobInfo> {
        tracing::debug!("Submitting Viewshed job");

        // Create GP service client for async Elevation service
        let gp_service = crate::GeoprocessingServiceClient::new(
            "https://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/Viewshed",
            self.client,
        );

        // Convert params to HashMap
        let param_map = self.params_to_hashmap(&params)?;

        // Submit job
        let job = gp_service.submit_job(param_map).await?;

        tracing::info!(
            job_id = %job.job_id(),
            status = ?job.job_status(),
            "Viewshed job submitted"
        );

        Ok(job)
    }

    /// Polls a Viewshed job until completion and returns the typed result.
    ///
    /// This is a convenience method that combines status polling with result extraction.
    ///
    /// # Arguments
    ///
    /// * `job_id` - Job identifier from `submit_viewshed`
    /// * `timeout_ms` - Optional timeout in milliseconds (default: 60000)
    ///
    /// # Returns
    ///
    /// Typed result containing viewshed polygon FeatureSet.
    ///
    /// # Example
    ///
    /// ```no_run
    /// # use arcgis::{ApiKeyAuth, ApiKeyTier, ArcGISClient, ElevationClient, ViewshedParametersBuilder};
    /// # async fn example() -> arcgis::Result<()> {
    /// # let auth = ApiKeyAuth::agol(ApiKeyTier::Location)?;
    /// # let client = ArcGISClient::new(auth);
    /// # let elevation = ElevationClient::new(&client);
    /// # let observer = r#"{"geometryType":"esriGeometryMultipoint","spatialReference":{"wkid":4326},"points":[[-119.5,37.85]]}"#;
    /// # let params = ViewshedParametersBuilder::default().input_points(observer).build().expect("Valid");
    /// # let job = elevation.submit_viewshed(params).await?;
    /// let result = elevation.poll_viewshed(job.job_id(), None).await?;
    ///
    /// tracing::info!(
    ///     viewshed_count = result.viewshed_count(),
    ///     "Viewshed analysis complete"
    /// );
    /// # Ok(())
    /// # }
    /// ```
    #[instrument(skip(self), fields(job_id, timeout_ms))]
    pub async fn poll_viewshed(
        &self,
        job_id: &str,
        timeout_ms: Option<u64>,
    ) -> Result<ViewshedResult> {
        tracing::debug!("Polling Viewshed job");

        let gp_service = crate::GeoprocessingServiceClient::new(
            "https://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/Viewshed",
            self.client,
        );

        // Poll until complete
        let job_info = gp_service
            .poll_until_complete(job_id, 2000, 5000, timeout_ms.or(Some(60000)))
            .await?;

        tracing::debug!(
            job_id = %job_info.job_id(),
            status = ?job_info.job_status(),
            "Job completed"
        );

        // Extract result from GP response
        self.extract_viewshed_result(&job_info).await
    }

    /// Helper to extract ViewshedResult from GP job info.
    async fn extract_viewshed_result(&self, job_info: &crate::GPJobInfo) -> Result<ViewshedResult> {
        tracing::debug!("Extracting Viewshed result from GP response");

        // Get results map
        let results = job_info.results();

        // Get OutputViewshed parameter
        let output_viewshed_param = results.get("OutputViewshed").ok_or_else(|| {
            tracing::error!("Results missing OutputViewshed parameter");
            crate::Error::from(ErrorKind::Api {
                code: 0,
                message: "Viewshed result missing OutputViewshed parameter".to_string(),
            })
        })?;

        // Get the value - either directly or by fetching from paramUrl
        let output_viewshed = if let Some(value) = output_viewshed_param.value() {
            // Value is directly available
            tracing::debug!("Using OutputViewshed value from inline response");
            value.clone()
        } else if let Some(param_url) = output_viewshed_param.param_url() {
            // Need to fetch from URL
            tracing::debug!(param_url = %param_url, "Fetching OutputViewshed from paramUrl");

            // Create GP client to fetch the result
            let gp_service = crate::GeoprocessingServiceClient::new(
                "https://elevation.arcgis.com/arcgis/rest/services/Tools/Elevation/GPServer/Viewshed",
                self.client,
            );

            // Fetch the result data
            let result_json = gp_service
                .get_result_data(job_info.job_id(), "OutputViewshed")
                .await?;

            // Extract the "value" field which contains the actual FeatureSet
            result_json
                .get("value")
                .ok_or_else(|| {
                    tracing::error!("Result data missing 'value' field");
                    crate::Error::from(ErrorKind::Api {
                        code: 0,
                        message: "OutputViewshed result data missing 'value' field".to_string(),
                    })
                })?
                .clone()
        } else {
            tracing::error!("OutputViewshed parameter has neither value nor paramUrl");
            return Err(crate::Error::from(ErrorKind::Api {
                code: 0,
                message: "OutputViewshed parameter has no value or paramUrl".to_string(),
            }));
        };

        // Parse as FeatureSet
        let feature_set: FeatureSet = serde_json::from_value(output_viewshed.clone())?;

        tracing::debug!(
            feature_count = feature_set.features().len(),
            "Parsed OutputViewshed FeatureSet"
        );

        let result = ViewshedResult::new(feature_set);

        Ok(result)
    }
}