Data functions extend Spotfire in ways that users understand but without them having to write any code. On this page you will find some geospatial data functions usable in Spotfire to extend its capabilities. For an overall overview of GeoAnalytics or Location Analytics capabilities of Spotfire please also review this page (clcik on link).

### Calculate areas of polygons

A data function that calculates the areas of polygons. The polygons must be specified in longitude/latitude coordinates. Requires the R packages `sp`, `geosphere`, and `wkb`.

Area of Polygons for Longitude-Latitude Coordinates.sfd

### Convert polygon coordinates to polygon geometries

A data function that inputs a table of coordinates representing polygons, and outputs a table with the polygons in the format native to Spotfire, for rendering in a Feature Layer on a Map Chart. Enables tables representing polygons to be rendered on maps in Spotfire.

Convert Polygon Coordinates to Polygon Geometries.sfd

### Draw circle with fixed radius on geographic coordinates

A data function to draw circles with fixed radius on a Spotfire map. The centers of the circles are specified by columns of geographic coordinates. The radius of the circles is given as a single value. The circle must be added as a Feature Layer using the coordinate reference system EPSG:4326 - WGS84.

Draw Circles with Fixed Radius on Geographic Coordinates.sfd

### Draw rectangles with fixed size on geographic coordinates

A data function to draw rectangles with fixed width and height on a Spotfire map. The centers of the rectangles are specified by columns of geographic coordinates. The width and height of the rectangles are given as a single pair of fixed values. The rectangles must be added as a Feature Layer using the coordinate reference system EPSG:4326 - WGS84.

Draw Rectangles with Fixed Size on Geographic Coordinates.sfd

### Find which marker(s) are located in a polygon

A data function that inputs a set of polygons and a set of points, and outputs which polygon each point is in. Requires the R packages `sp` and `wkb`.

For cartesian coordinate: Points In Polygons (Geofencing) for Cartesian Coordinates.sfd

For longitude/latitude cooridnates: Points In Polygons (Geofencing) for Longitude-Latitude Coordinates.sfd

### Tranform CRS for imported shapefile (.shp) by EPSG code

A data function that converts an imported shapefile from one coordinate reference system to another, using EPSG codes to specify the reference systems. Requires the R packages `sp`, `rgdal`, and `wkb`. Note that the environment variable GDAL_DATA must be set to the location of the gdal folder in the rgdal folder in the library folder where TERR is installed. EPSG codes can be looked up from the .prj files in shapefiles at http://prj2epsg.org/.

Transform CRS for Imported Shapefile by EPSG Code.sfd

### Tranform CRS for imported shapefile (.shp) by PROJ.4 string

A data function that converts an imported shapefile from one coordinate reference system to another, using PROJ.4 strings to specify the reference systems. Requires the R packages `sp`, `rgdal`, and `wkb`. For some PROJ.4 strings, requires the environment variable PROJ_LIB to be set to the location of the proj folder in the rgdal folder in the library folder where TERR is installed. PROJ.4 strings can be looked up at http://spatialreference.org/.

Transform CRS for Imported Shapefile by PROJ.4 String.sfd

### Tranform CRS for markers by EPSG code

A data function that converts columns of geographic coordinates from one reference system to another, using EPSG codes to specify the reference systems. Requires the R packages `sp` and `rgdal`. Note that the environment variable GDAL_DATA must be set to the location of the gdal folder in the rgdal folder in the library folder where TERR is installed. EPSG codes can be looked up from the .prj files in shapefiles at http://prj2epsg.org/.

Transform CRS for Points by EPSG Code.sfd

### Tranform CRS for markers by PROJ.4 string

A data function that converts columns of geographic coordinates from one reference system to another, using PROJ.4 strings to specify the reference systems. Requires the R packages `sp` and `rgdal`. For some PROJ.4 strings, requires the environment variable PROJ_LIB to be set to the location of the proj folder in the rgdal folder in the library folder where TERR is installed. PROJ.4 strings can be looked up at http://spatialreference.org/.

Transform CRS for Points by PROJ.4 String.sfd

### Map Contour Plot

This Data Function generates a contour plot as a feature layer on a map chart. This download (click on link) from the TIBCO Community Exchange contains a data function you can import into your own .dxp and a template you can bring your own data into.