Products / SDKs / Geometric operations

Geometric operations

Move, combine, buffer, clip and measure shapes, and check them against topology rules. Each operation is a single call on the shape.

Working with geometries

Operations

An operation is often one step in a chain. To reach the households near each of your stores without two campaigns covering the same street, buffer each store by a mile, clip the circles where they overlap, then query the households inside each one.

Each card links to working sample code on GitLab. WPF is the ThinkGeo 15 gallery; WPF Classic is the gallery that also builds for .NET Framework. A grayed-out platform has no sample for that yet.

The Frisco county polygon moved to a new position

Translate

Move a shape to a new center point, or a distance in a direction. Move a storm's footprint along its track, then query the buildings in its path.

The Frisco county polygon rotated

Rotate

Turn a shape by any angle, around its own center or around another point. When the wind shifts, a chemical plume can be turned about its source.

The Frisco county polygon scaled down

Scale

Grow or shrink a line or polygon by a percentage of its size, such as an exclusion zone that has to widen. The editing tools use the same call when users drag a handle.

The Frisco county polygon formed by the union of two polygons

Union

Combine shapes into one. Touching shapes merge and lose their shared boundary; separate ones become a single multipolygon. Union the coverage circles of several radio towers to get the total area they reach.

The Frisco county polygon simplified

Simplify

Remove vertices without changing the overall shape, so a detailed boundary keeps its accuracy for measurement and draws quickly when the map is zoomed out.

Land parcels with a rectangle drawn across them, the area they share shaded

Clip

Keep only the area two shapes share, with the first shape's attributes. Clip a school district to an evacuation zone and send the result to the district.

The convex hull of the Frisco county polygon

Convex hull

The smallest convex shape that covers a feature. Testing a point against the hull before the full polygon speeds up millions of point-in-polygon checks.

The envelope of the Frisco county polygon

Envelope

The smallest rectangle around a shape, stored as two corners. It is quick to compute, it underlies nearly every spatial index, and it makes a cheap first test before a full spatial operation.

The shortest line between Toyota Stadium and the Frisco Commons

Shortest line

The shortest straight path between the outsides of two shapes, on a planar grid. In decimal degrees it can look curved on the map, the way airline routes do.

Shapes drawn on a map of the United States, each labeled with its area in acres

Area, length and center

Area in a choice of units, length (for a polygon, the length of its boundary), and the center point, taken from the envelope or from the center of gravity.

Topological validation

Check shapes against rules

Validate data as it is created or edited, and get back the parts that break a rule. For the counties in a state, check that they leave no gaps and that each lies within the state.

Points validated against lines and polygons

Point rules

For sample points that must stay in their area, or stops that must sit on a route.

  • Must touch lines
  • Must touch line endpoints
  • Must touch polygon boundaries
  • Must be within polygons
Lines validated for self-intersection

Line rules

For new streets that must not overlap others or cross themselves.

  • Endpoints must touch points
  • Must overlap polygon boundaries
  • Must be covered by other lines
  • Must be a single part
  • Must form a closed polygon
  • Must not have pseudonodes
  • Must not intersect
  • Must not self-intersect or touch
  • Must not overlap
  • Must not overlap other lines
  • Must not self-intersect
  • Must not self-overlap
Polygons validated as within another polygon

Polygon rules

For states within a country, or counties that must not overlap.

  • Boundaries must overlap boundaries
  • Boundaries must overlap lines
  • Must overlap other polygons
  • Must be within other polygons
  • Must contain points
  • Must overlap each other
  • Must not leave gaps
  • Must not overlap
  • Must not overlap other polygons