Skip to content
This sample shows how you can use Map Suite Elevation SDK to get the elevation value of a specific point for your .NET application.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
ElevationStatistics
.gitignore
ElevationStatistics.sln
README.md
Screenshot.png

README.md

Elevation Statistics Sample for WPF

Description

This Sample shows the elevation data of a road in the form of a line chart.

  • Elevation SDK - support query elevation data by points, line and polygon based on SRTM and Ned13 elevation source data.
  • For point - Create a buffer and aggregate all points within buffer to create average for the elevation of the point.
  • For line - There are two ways to get the elevation data of the line. First, get the points on the line by setting the interval distance. The other, is to take the points by setting the number of points to be fetched. Then query the elevation data of the point.
  • For polygon - By setting the interval distance, clip the polygon to the grids and get all the center of the grids where the polygon is located. Now, determine whether the center points are within the surface or inside the surface (use improved arc-length method).

Screenshot

Requirements

This sample makes use of the following NuGet Packages

About the Code

Get elevation by points

// If you have Elevation Data on the local machine, pass in the folder where the data exists. 
private Collection<Feature> GetElevationByPoints(Collection<PointShape> points)
{
    Elevation.Elevation elevation = new Elevation.Elevation();
    elevation.ElevationFeatureSources.Add(new SrtmElevationFeatureSource(sourceDir));
    elevation.Open();
    var features = elevation.GetElevationByPoints(points, 3857, DistanceUnit.Meter);
    elevation.Close();
    return features;
}
// After purchasing the Elevation data, you can consume the data online by passing in the Amazon ID and Key, like following.   
private Collection<Feature> GetElevationByPoints(Collection<PointShape> points)
{
    Elevation.Elevation elevation = new Elevation.Elevation();
    elevation.ElevationFeatureSources.Add(new S3CompressedSrtmElevationFeatureSource("accessKeyId", "secretAccessKey", "cacheFolder"));
    elevation.Open();
    var features = elevation.GetElevationByPoints(points, 4326, DistanceUnit.Meter);
    elevation.Close();
    return features;
}

Get elevation value and point

foreach (var feature in features)
{
	PointShape point = new PointShape(feature.ColumnValues["point"]);
	double value = double.Parse(feature.ColumnValues["elevation"]);
}

Getting Help

About Map Suite

Map Suite is a set of powerful development components and services for the .Net Framework.

About ThinkGeo

ThinkGeo is a GIS (Geographic Information Systems) company founded in 2004 and located in Frisco, TX. Our clients are in more than 40 industries including agriculture, energy, transportation, government, engineering, software development, and defense.

You can’t perform that action at this time.