Jump to content
  • Points in Polygons Data Function for Spotfire


    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 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.

    Please download the Points in Polygons Data Function for Spotfire® from the exchange. 

    Details about the data function

    Programming Language: TERR 6.0.3/R 4.3.1

    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: Shapefile with outlines of US States.

    pip1.thumb.png.e4613ea6be377a328973661b7af0070f.png

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

    pip2.png.ce88500e3c8aeb7649392a96574cb505.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.3b12f712dbf86fa01e4582783195675b.png


    More Resources

    • Like 1

    User Feedback

    Recommended Comments

    There are no comments to display.


×
×
  • Create New...