Jump to content
We've recently updated our Privacy Statement, available here. ×

Points in Polygons Data Function for Spotfire® 1.1.0


2 Screenshots

Summary

Geospatial data can come in several forms, for example locations of specific points, or polygons that define areas of interest. When both point and polygon data are present, it is often useful to identify the enclosing polygon for each point.

Overview

For each point in a table of locations defined by Latitude and Longitude coordinates, identify its corresponding enclosing polygon contained in a separate table. Returns a column that contains the enclosing polygon identifier to append to the point location table.

Geospatial data can come in several forms, for example, locations of specific points, or polygons that define areas of interest.   

When both point and polygon data are present, it is often useful to identify the enclosing polygon for each point, so information from both tables can be merged.

This TERR data function, "Points in Polygons", performs this identification; this data function is useful if you have a shapefile containing polygons, and a separate table containing Latitude-Longitude coordinates of points.

More details can be found here or here

 

Details about data function

Required R Packages: sp, wkb

Description: For each point in a table of locations defined by Latitude and Longitude coordinates, calculate which is its corresponding enclosing polygon from a separate table. Returns a column that contains the enclosing polygon identifier to append to the point location table.

Inputs:

  • Geometry (Geometry column from shapefile table)
  • ID (Identifier column from shapefile table)
  • Longitude (Longitude column from point table)
  • Latitude (Latitude column from point table)

Output:

  • Id (column to append to the point table)

This dxp file illustrates this process using two tables:

  • Point locations of some US airports
  • State shapefiles

Example Input Table #1: Polygons: Shape file with outlines of US States;

pip1.thumb.png.f8bebf323c00ebf22a795b7a72261ad5.png

Example Input Table #2:  Point data: Geographic locations of some US Airports:

 

pip2.png.3ecdadce7b85f99a5e28d1339eddfa66.png

Example Output:  After running the TERR "Points in Polygons" data function, a new column named "Id" containing the state name identifier from the Shapefile is now present in the Airport Location table:

pip3.png.6e8fc9d69abdfb8ce53f688eac1cce48.png

Data Sources

State Shapefile from US Census, "Cartographic Boundary Shapefiles - States"

Airport data from FAA, Federal Aviation Administration,

 

Release 1.1.0

Published: November 2023
Changes to the previous release:

  • Extra documentation added to the script


 

Release 1.0

Published: October 2016

Initial Release


×
×
  • Create New...