Understanding and Using Geometry, Projections, …...Introduction We want to give you a basic...

56
Understanding and Using Geometry, Projections, and Spatial Reference Systems in ArcGIS Rob Juergens, Melita Kennedy, Annette Locke March 8–11, 2016 | Palm Springs, CA Esri Developer Summit

Transcript of Understanding and Using Geometry, Projections, …...Introduction We want to give you a basic...

Understanding and Using Geometry, Projections, and Spatial

Reference Systems in ArcGISRob Juergens, Melita Kennedy, Annette Locke

March 8–11, 2016 | Palm Springs, CA

Esri Developer Summit

IntroductionWe want to give you a basic understanding of geometry and spatial references

• We won’t show you code- Our libraries are low level- Many APIs built on top

• We will talk about- Geometry types- Spatial references and their properties- How geometries and spatial references interact

Geometry

What is a geometry?

• Defines the shape of a feature• Points, lines, and polygons represent real-world objects

Points

Building blocks for all geometries

Multipoints

Each multipoint feature is a collection of points

Polylines

EllipticalArc

Points are used to build segments

Composed of paths

Composed of segments

Segments can be four types

Polyline

Paths

Line BézierCurve

CircularArc

Points

Segments

A collection of paths

Polylines

Single part Multipart

Polygons

EllipticalArc

Points are used to build segments

Composed of rings

Composed of closed segments

Segments can be four types

Polygon

Rings

Line BézierCurve

CircularArc

Points

Segments

A collection of rings

Polygons

Inner ring

Outer ring

We want “valid” geometries

• What? - Adhere to a specified set of topological rules- Known as “simple”

• Why? - Storage in a database- Cannot rely on results from operations using non-simple geometries

- Get an error- Get incorrect results

• How?- ArcGIS Pro and ArcMap

- Check Geometry and Repair Geometry GeoProcessing tools- ArcGIS Server

- IsSimple and Simplify operations- All Esri APIs have similar functionality

Non-simple Polygons

Simple PolygonsSimplifying may add or remove vertices

Demo

Why do we care if geometries are simple?

Spatial References

Key properties of spatial references

• Coordinate system - Geographic- Projected

• XY Resolution

• XY Tolerance

Coordinate SystemsGeographic (GCS)

Projected (PCS)

What is a coordinate system?

An instrument used to answer questions about distance, location, and direction

What is a coordinate system?

• Q: How far is Redlands?• A: 32 million

32 million what? Seems like a lot. • 32 million feet from Beijing. What were you expecting?• Miles from where I am right now. • A coordinate system defines what is expected

What is a coordinate system?

• Q: Where is Palm Springs?• A: (-116.53, 33.82), no wait, it is (-12973635.720, 4006201.638)

What do these numbers mean?• (-116.53, 33.82) are longitude and latitude in decimal degrees • (-12973635.720, 4006201.638) are xy-coordinates in meters• How am I supposed to know that?• A coordinate system defines what these numbers mean

What is a coordinate system?

• Q: I am looking at a map and want to place a marker at the North Pole. Where do I put it?

• A: At the top of the map. Hmm, or at the center. Or … hang on, it’s impossible. The North Pole isn’t on the map!

• Wait, what? • A coordinate system defines where a particular location is on the map or specifies

that it isn’t on the map at all

Geographic Coordinate System (GCS)

• Global – 3D spherical surface• Point referenced by longitude and latitude values

Projected Coordinate System (PCS)

• Flat – 2D surface based on a GCS

X

Y

(0,0)

X > 0Y > 0

X < 0Y > 0

X < 0Y < 0

X > 0Y < 0

• Point referenced by x, y coordinates on a grid

Datum

Spheroid

Prime Meridian

Projection Parameters

Projection

Projected Coordinate System

Geographic Coordinate System

Coordinate System

Angular Unit

Linear Unit

Geographic Coordinate SystemWell-Known Text (WKT)

GEOGCS[ "GCS_WGS_1984",DATUM[ "D_WGS_1984",

SPHEROID[ "WGS_1984", 6378137.0, 298.257223563] ],PRIMEM[ "Greenwich", 0.0],UNIT[ "Degree", 0.0174532925199433] ]

Projected Coordinate SystemWell-Known Text (WKT)

PROJCS[ “World_Mercator",GEOGCS[ "GCS_WGS_1984",

DATUM[ "D_WGS_1984",SPHEROID[ "WGS_1984", 6378137.0, 298.257223563] ],

PRIMEM[ "Greenwich", 0.0],UNIT[ "Degree", 0.0174532925199433] ],

PROJECTION[ "Mercator " ],PARAMETER[ "Central_Meridian", 0.0], PARAMETER[ "Standard_Parallel_1", 0.0],PARAMETER[ "False_Easting", 0.0],PARAMETER[ "False_Northing", 0.0],UNIT[ “Meter", 1.0] ]

Well-Known ID (WKID)• Every predefined coordinate system has a WKID

- For example, GCS_WGS_1984, WKID = 4326

• WKID < 32767 is EPSG assigned- EPSG Geodetic Parameter Dataset, http://www.epsg-registry.org/

• WKID > 32767 is Esri assigned- Esri WKID may change - Esri → EPSG- Old WKID will still work- Example, Web Mercator 102100 → 3857

Why are there so many different projections?• All projections have some kind of distortion• SADD = Shape Area Direction Distance

• Web Mercator distorts area and distance

• Which is bigger? GreenlandSouth AmericaAntarctica

South America is 17 million sq kmAntarctica is 14 million sq kmGreenland is 2 million sq km

• Pick the projection that minimizes distortion of one or two characteristics

Preserve Shape and Direction

Stereographic

• Shapes are accurate

• Area distorts as move away from center

• Direction accurate from the center

• Distance distorts as move away from center

Preserve Area

Sinusoidal

• Shape distorted except along central meridian and equator

• Area is accurate

• Direction distorted except along central meridian and equator

• Distance distorted except along central meridian and equator

• Used for world maps showing area

Preserve Area, Shape, and Direction in a certain region

Albers Equal Area Conic

• Shape minimally distorted in certain region

• Area is accurate

• Direction accurate along standard parallels

• Distance distorted except near middle latitudes

Preserve Direction

Gnomonic

• Shape distorted as move away from center

• Area distorts as move away from center

• Direction accurate from center outward

• Distance distorted

• All great circles are straight lines

• Good for navigation

Preserve Direction and Distance

Azimuthal Equidistant

• Shape distorted except at center

• Area distorts as move away from center

• Direction accurate from center outward

• Distance accurate from center outward

• Good for air, sea navigation

What is happening when we project data?

PCS A2

GCS A

PCS A1

(lon, lat)

(x, y)

(λ, φ)

Case 1: Both PCSs contain the same GCS

Geographic TransformationOr Datum Transformation

GCS A

PCS A1

GCS B

PCS B1

Case 2: Each PCS contains a different GCS

What is happening when we project data?

(lon, lat)

(x, y)

(λ, φ)

ProjectionProjection

Why do we need to transform our data?

European Datum 1950 vs. World Geodetic System 1984

Geographic (Datum) Transformation (GT)

• Convert from one GCS to another GCS- Each GCS has a datum associated with it- How do we transform lat/long from one datum to another?

What is a datum?

Earth’s surfaceEarth-centered datum (WGS 84)

My data

Local datum (NAD 27)

Geographic Transformation (GT)

• Defined in a particular direction- For example, NAD27 to WGS84- All are reversible

• Suitable for a particular area

• May be more than one applicable GT

33 transformations between NAD 27 and WGS 84

Which is best?

Depends on the region covered by your data

Demo

How do I find transformations?

Resolution and

Tolerance

XY Resolution• Numeric precision used to store x, y coordinate values• All coordinates lie on coordinate grid• Default value is 0.0001 meters or equivalent

- x1 = 5.1234, x2 = 5.1235 stored as unique coordinate values- x1 = 5.12344, x2 = 5.12345 both stored as 5.1234- Each square in grid is 0.0001 x 0.0001

XY Tolerance

• Minimum distance between coordinates

• Comes into play when we are working with geometries- Make sure our geometries are simple- Topological operations

- For example, Buffer, Symmetric Difference, Union, Intersection- Relational operations

- For example, Disjoint, Touches, Overlaps, Crosses, Within- Editing operations

XY Tolerance

Default value = 0.001 meters or equivalent

Do these two points intersect? Yes, since the distance between them is less than the tolerance.

XY Tolerance

Editing Merge operation

Demo

Merge Polygons

Resolution vs. Tolerance

Highly recommended to use default values!

Resolution Tolerance

Used to store geometry in database Used when doing something with geometry

Determines number of decimal places to store Determines if points are considered equal

Default = 0.0001 meter or equivalent Default = 0.001 meter or equivalent

Tolerance must be at least 2 times resolutionTolerance should be at least 10 times resolution

What do spatial references have to do with geometries?

• We need to know where to put the geometry on the map

• Spatial reference could change the geometry visually or structurally

• An operation may give different results depending on the spatial reference

Demo

Where is my data?

Spatial reference can change the geometry visually or structurally

Here we have the same geometry in 4 different spatial references

WGS 84

South Pole GnomonicCube

Azimuthal Equidistant

An operation on a geometry may give different results depending on the spatial reference

For example, Buffer operation

Demo

Buffer and Spatial Reference

That’s all folks!

Don’t forget to fill out the survey

Understanding and Using Geometry, Projections, and Spatial Reference Systems in ArcGIS

Rob Juergens, Melita Kennedy, Annette Locke

Resources

http://resources.arcgis.com/en/helpDesktop → Guide Books → Map projectionsDeveloper Help

List of ArcGIS APIs

Lining Up Data in ArcGIS, Margaret Maher

ESRI Technical paper: Understanding Coordinate Management in the Geodatabase

ESRI Technical paper: Understanding Geometric Processing in ArcGIS