User Tools

Site Tools


map_suite_ios_geometric_functions

This is an old revision of the document!


Map Suite iOS Geometric Functions

Video Overview

Introduction

The Map Suite iOS Geometric Functions Learning Sample shows some of the most popular ways you can manipulate points, lines, and polygons. For this sample, press the “Go” button in the upper-right corner of your iPad or iPhone to run the selected geometric function.

Union

The Union function merges two or more existing feature shapes into one feature. Any overlapping features on the map will be merged together into one continuous shape. To do this, select the feature you'd like to add the other features to. This might be the feature with the name, ID, or other attribute data you'd like to retain. In the image below, multiple polygon features (left) are merged into a single polygon feature (right). More information.

Border

If you like, developers can also set the Union function up to work with multiple layers. When configured this way, a union will combine all the features and geographical extents of two layers. For example, in the image below, the Union function combines two separate but overlapping layers (left) into a single new output layer. More information.

Border

Difference

The Difference function compares two features and cuts out the overlapping area of the target feature from the original feature, creating a resultant feature. More information.

border

You can also set the Difference function up to work with multiple layers. When configured this way, the Difference function will create a new layer made from cutting the target layer out of the original layer. Note that the two input layers must have the same geometry type (polygon, line or point). More information.

Buffer

Buffer draws a polygon extending a given distance around a set of features, or a single feature. The buffer can have square or rounded corners. For example, you might want to create a buffer area representing flood hazard zones that extends for 3 miles in each direction around rivers, streams, and creeks, or you might want to visualize a non-compete zone within 10 miles of a business. You can buffer any type of feature - point, line, or polygon.

In the image below, notice that the yellow buffer on the right extends slightly beyond the polygon's boundaries.

border

Choose to buffer all of a layer's features, or only selected feature(s).

Dissolve Buffers

You can dissolve buffers to remove the borders of overlapping buffer zones.

border

Negative Buffers

You can also input a negative buffer distance to create buffers inside polygons.

Scale

This function scales a feature up or down by a percentage centered on the centroid, or geometric center. In other words, it changes a feature's size to make it larger or smaller. More information.

border

Rotate

This function rotates the shape by a number of degrees. More information.

border

Center Point

Center Point returns the centroid of a polygon or the center of a line. This sample also shows the center of the Bounding Box, which is the rectangle that fits around the feature.

border

Area Calculation

The Area Calculation function calculates and displays the area of a polygon feature. Our sample shows the area in hectares and acres, but you could modify the function to show the area in any units you desire.

border

Simplify

Takes a complex polygon and reduces the number of sides so that the new polygon is an estimate of the original. Complex polygons can be processor intensive, so if you only require an estimate, Simplify can increase performance.

border

Split

The Split function allows you to split a polygon or line feature into two features by drawing a line through it at the desired split location. For example, this tool could be used to split a field into multiple crop types in agriculture or in real estate to subdivide a parcel.

border

Get Shortest Line

Calculates the distance between 2 features. With complex polygons, it’s not always apparent what the shortest line is to human eyes. Can also be used to find the shortest distance between points and lines.

border

Length Calculation

Shows the lengths of a line. Can be in feet or meters. Of course, you could modify the function to show kilometers or miles.

border

Get Line on a Line

Creates a new line based upon a subset of the line. For example, if there is a chemical spill on a road, and you need to shut down the road 1000 feet around it, you could create a buffer around the point. Then, where the buffer intersects with the road is the location of where the roadblock needs to be. Use “Get Line on a Line” to highlight the section of the road that is impassible.

border

Clip

The Clip function clips or crops a layer's extent to match the extent of another layer. For example, you could use the Clip tool to crop a layer of state highways (input feature) to the extent of a layer covering only a single county (clip feature). Layers do not need to share the same geometry type. In our example, the blue polygon is the cookie-cutter. Upon running, only the features inside the polygon remain. You could modify the function to perform the inverse and only leave the features outside of the polygon.

border

Convexhull

Convexhull encapsulates all points or polygons inside a perimeter. In our example, there are 5 fires in a field. Use Convexhull to highlight the burn area. There is also a shape with rounded edges and concave portions. Convexhull is used to surround the shape and finish with no concave sections.

border

Snapping

If a vertex is within a certain radius of another feature, snapping aligns them. If you’ve traced a road based upon aerial imagery, use Snapping to line up the points. In our example, the left vertex is within the radius and will snap to the line, while the right vertex is not within the radius and therefore will not snap.

border

Envelope Boundingbox

Have an irregularly-shaped polygon? Envelope Boundingbox displays the rectangle that surrounds it. This is helpful so you can zoom into that feature. You can also create a rectangle around multiple features. This tool can be useful for representing the footprints of buildings or parcels of land.

border

A Look at the Code

Main.cs is the entrance to the app. It opens AppDelegate.cs. Storyboards contain UI and the relationship between UIs, but for this sample they are blank. MainViewController.cs contains the UI and imports the XML file that lists all samples and the data for each sample. ViewDidLoad() is the iOS event for page load.

In the Controllers folder, there is a controller for each of the Geometric Functions. Each Geometric Function controller includes an Initialize function, which sets up the MapView, and an Execute function, which runs the Geometric Function. Under Controllers > Advanced, DetailVewController.cs has common functions that are inherited by the Geometric Function controllers. SliderViewController.cs handles the menu that slides in from the left side of the map.

map_suite_ios_geometric_functions.1442560913.txt.gz · Last modified: 2015/09/18 07:21 by admin