This document (including, without limitation, any product roadmap or statement of direction data) illustrates the planned testing, release and availability dates for Spotfire products and services. It is for informational purposes only and its contents are subject to change without notice. Planning to implement - generally 6-12 months out. Likely to Implement - generally means 12-18 months out.
Copyright © 2014-2023 Cloud Software Group, Inc. All Rights Reserved.
Cloud Software Group, Inc. ("Company") follows the EU Standard Contractual Clauses as per the Company's Data Processing Agreement.
Terms of Use |
Privacy Policy |
Trademarks |
Patents |
Contact Us
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
R
programming 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 4326
data_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 vectors
lng_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_y
min_x <- mid_x - 3 * step_x
max_x <- mid_x + 3 * step_x
rig <- 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 map
lng_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 object
data_sf$geometry <- sf::st_as_sfc(lng_lat_sf)
# Save as .shp file for .dxp import
sf::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