Is should be possible to upload and use custom markers. For instance in map layer, it would be nice to have specific icons displayed e.g. Service Van, House, Wind turbine etc.
| Implemented in | 14.5 |
Spotfire 14.5 enables company or industry-specific customization of data points represented as markers in map visualizations and scatter plots. Learn more about what's new in Spotfire 14.5.
Add a way to import custom markers into your visualization. Such as symbols or different fonts.
@Jason, you're correct - run in open-source R, and import as
.shp.So did you run this code on standard R and then import the shapefile?
I get errors when trying to run this via TERR.
You could also consider using centered labels that are images rather than text. I've successfully used that for drilling rigs before.
Forgot the credits where it's much due 😅
Special thanks to the [R Core team](https://www.R-project.org/), [tidyverse](https://github.com/tidyverse/tidyverse), and [sf](https://github.com/r-spatial/sf) authors.
While we continue waiting for the dev team to add this as a core function, here's a workaround for those familiar with
Rprogramming language.This particular use case draws a drilling rig as the custom marker.
For other use cases, unleash the creative artist in you! I'm sure some other users will appreciate/use the work ya'll share :)
# `data_raw` is a spatial data frame with latitude and longitude; in this case in CRS 4326data_sf <- sf::st_as_sf(data_raw, coords = c("lng", "lat"), crs = 4326)# Munge default geometry object, which is a point# First, get it out as vectorslng_lat <- lapply(data_sf$geometry, as.vector)# The key _drawing_ function for a drilling rig; a minimalist artist I am, as you'll see :)draw_rig <- function(mid_x, step_x, mid_y, step_y) {max_y <- min_y <- mid_y - 3 * step_ymin_x <- mid_x - 3 * step_xmax_x <- mid_x + 3 * step_xrig <- sf::st_linestring(cbind(c(min_x, mid_x, mid_x + step_x, mid_x - step_x, mid_x + 2 * step_x, mid_x + step_x, mid_x - 2 * step_x, mid_x + 2 * step_x, max_x),c(min_y, mid_y, mid_y - step_y, mid_y - step_y, mid_y - 2 * step_y, mid_y - step_y, mid_y - 2 * step_y, mid_y - 2 * step_y, max_y)))return(rig)}# Apply _drawing_ function; step_x and step_y are set based on personal taste and affect the size of marker in maplng_lat_sf <- purrr::map(lng_lat,~ draw_rig (mid_x = .x[[1]],step_x = 0.167 / 2,mid_y = .x[[2]],step_y = 0.334 / 2))# Convert back to sf objectdata_sf$geometry <- sf::st_as_sfc(lng_lat_sf)# Save as .shp file for .dxp importsf::st_write(data_sf,"rigs.shp",driver = "ESRI Shapefile",delete_layer = TRUE)Similar use-case: I would like to modify the map-markers if a certain condition is met in a column
Ex.
The map marker is a blue circle because the Feature is a House, and that circle is outlined in red because it is a House and its Latitude is greater than 29.756