Use functions in the Map application to create custom shapes, symbols, and labels from your object data through a rendering function. For example, a rendering function can draw a route between two locations, calculate a coverage area, or change a shape's appearance based on several object properties.
Function-based styling computes values used to style an existing display. Rendering functions let you define both what appears on the map and how it looks. You can combine multiple rendering functions with other displays on the same layer. To compare rendering functions with function-based styling and pipelines, review Use functions to customize maps. To learn more about display limitations, such as those in 3D mode, review Limitations.

Default styles and rendering functions are only available if your enrollment contains Map Rendering Service (MRS) and these displays are enabled in the Map application. If your enrollment contains MRS, the Application styles tab is available for object types in Ontology Manager. Additionally, you must have access to TypeScript v2 code repositories that contain the map-rendering-types-asset-bundle library asset.
Contact Palantir Support with questions about the availability of MRS, TypeScript v2 code repositories, or the map-rendering-types-asset-bundle library on your enrollment.
Choose the function type based on the data needed to create your visualization.
| Function type | Return type | Use when | Example |
|---|---|---|---|
| Object rendering function | IMrsPerObjectRendererOutput | Each object's properties and the configured inputs provide everything needed to draw its visualization. | Draw a route using an object's origin and destination locations. |
| Object set rendering function | IMrsObjectSetRendererOutput | The visualization needs to combine multiple objects or load additional data. | Group flights by destination and draw a bubble for each airport. |
For TypeScript v2, the return type identifies the function type. You add both types through the same Rendering function display; no separate map setting is required.
Object rendering functions cannot load additional objects, follow links, or call external services. Their output updates as relevant input property values change.
Object set rendering functions can load additional data, subject to the user's permissions. They can take longer to run and do not update on every individual property change.
Follow the instructions in the sections below to create a rendering function. Example object and object set rendering functions are included, as well.
Create or open a TypeScript v2 functions repository, then follow the instructions below to add the map rendering library:
map-rendering-types-asset-bundle.
@palantir/map-rendering-foundry-functions-api.Your function must return geometry and styling information using an output type from this library. Supported additional function inputs become configurable fields when you add the function to a map, except for automatically supplied inputs.
An object rendering function returns IMrsPerObjectRendererOutput. Its renderables list contains IMrsPerObjectRenderable items, each with an id and a content map that defines what to draw. The input object is automatically associated with each item.
An object set rendering function returns IMrsObjectSetRendererOutput with two lists:
renderables: Items of type IMrsRenderable. Each has the same id and content fields as an object rendering function's output, plus a sourcing field.sourcing: Source records that describe what each result represents. Each record has an id, a display title, and content.Each item's sourcing value must match an id in the output's sourcing list. You must provide these associations because a result calculated from an object set does not necessarily represent one input object. These fields describe the function's output, not inputs that a map user configures.
Choose the source record's content type based on what the result represents:
IMrsAggregateRendererSourcingContent_Object for a specific Foundry object. Set type to "object" and provide the object type RID as objectType and the object RID as objectRid in the object field. This associates the visualization with that object so users can navigate to it.IMrsAggregateRendererSourcingContent_NonObject for a calculated group or shape, such as a cluster or hull, that does not represent a single object. Set content to { type: "nonObject", nonObject: {} }.Keep item and source IDs stable between runs when they represent the same result.
Function inputs let you reuse a visualization without editing its code.
For an object rendering function, you can configure supported inputs using:
Object set rendering functions use fixed values for their configurable inputs.
Supported inputs include text, numbers, Boolean values, geopoints, and geoshapes. For TypeScript v2, import Point for geopoints or Geometry for geoshapes from @osdk/functions. Geoshapes include geometries such as polygons and line strings. Symbols, structured values, lists, dates, and timestamps are not supported as configurable inputs.
For an object set rendering function, declare the object set as the first parameter, as shown by objects?: ObjectSet<ExampleFlight> in the object set example. The layer supplies this input automatically, so users do not configure it in the display.
You can also declare these optional inputs with exact names and types, as they are supplied automatically and do not appear as configurable fields:
objectSetRid?: string: The input object set's resource identifier, for functions that need the identifier explicitly.sourcingOnly?: boolean: When true, only source information is needed. You can return the sourcing list with an empty renderables list to skip unnecessary geometry and styling calculations.Rendering functions can produce the same displays as application styles, including geometry with labels, Web Mercator raster tiles, and events and moving objects. Raster imagery can come from a rendering function added directly to a map or included in an object type's application styles.

After testing your function in live preview, commit and publish a version. Committing the code alone does not make the function available in the Map application.
To use the published function, add a rendering function display to an object layer and select your function. For the route example, connect origin and destination to the layer's geopoint properties, and connect delayMinutes to a numeric delay property.

For the destination bubble example, add the function to a layer of ExampleFlight objects. The layer supplies the object set automatically; this example has no configurable inputs.
Functions included in an object type's application styles are read-only in the Map application. Add a separate rendering function display if you need different inputs for your map.
The following object rendering function draws a line between two locations. Routes with a delay greater than 15 minutes appear red; other routes appear blue.
The function accepts locations as inputs, so you can reuse it with different object types. The route is calculated when the function runs and does not need to be stored as a separate property.
Create a function file named renderRoute.ts in your repository's functions directory:
Copied!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44import type { Double, Point } from "@osdk/functions"; import type { IMrsPerObjectRendererOutput } from "@palantir/map-rendering-foundry-functions-api"; export default function renderRoute( origin?: Point, destination?: Point, delayMinutes?: Double, ): IMrsPerObjectRendererOutput { if (origin == null || destination == null) { return { renderables: [] }; } const color = (delayMinutes ?? 0) > 15 ? "#DB3737" : "#137CBD"; return { renderables: [ { id: "route", content: { route: { type: "geometry", geometry: { geometry: { type: "LineString", coordinates: [ origin.coordinates, destination.coordinates, ], }, style: { stroke: { color: { rgb: color, a: 255 }, pattern: { type: "solid", solid: color }, opacity: 255, width: 2, }, }, }, }, }, }, ], }; }
If either location is missing, the function draws nothing for that object. If the delay is missing, the example treats it as zero.

The following object set rendering function groups flights by destination airport and draws a labeled bubble at each destination. Bubble size increases with the number of flights. Each bubble represents a calculated group, so the example uses a nonObject source rather than associating it with an individual flight.
Before using the example, import your object type and generate the Ontology SDK. This example assumes an ExampleFlight object type with the following properties:
| Property API name | Type | Purpose |
|---|---|---|
destinationAirport | String | Airport code used to group flights. |
destinationDisplayAirportName | String | Name displayed in the source title. |
destinationGeopoint | Geopoint | Location of the destination airport. |
Replace the object type and property API names with those from your Ontology. Flights with the same destination code should use the same airport location. Create a function file named flightDestinationBubble.ts:
Copied!1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94import type { ObjectSet } from "@osdk/client"; import type { Point } from "@osdk/functions"; import type { ExampleFlight } from "@ontology/sdk"; import type { IMrsObjectSetRendererOutput, IMrsRenderable, } from "@palantir/map-rendering-foundry-functions-api"; interface AirportBucket { name: string; location: Point; count: number; } export default async function flightDestinationBubble( objects?: ObjectSet<ExampleFlight>, ): Promise<IMrsObjectSetRendererOutput> { const output: IMrsObjectSetRendererOutput = { renderables: [], sourcing: [] }; if (objects == null) { return output; } const buckets = new Map<string, AirportBucket>(); let maxCount = 1; for await (const flight of objects.asyncIter()) { const code = flight.destinationAirport; const location = flight.destinationGeopoint; if (!code || location == null) { continue; } const bucket = buckets.get(code) ?? { name: flight.destinationDisplayAirportName ?? code, location, count: 0, }; bucket.count++; buckets.set(code, bucket); maxCount = Math.max(maxCount, bucket.count); } for (const [code, bucket] of buckets) { const id = `destination-${code}`; const scale = Math.sqrt(bucket.count / maxCount); const relativeSize = bucket.count / maxCount; const color = relativeSize < 1 / 4 ? "#7dea16" : relativeSize < 1 / 2 ? "#ffe573" : relativeSize < 3 / 4 ? "#D9822B" : "#DB3737"; output.sourcing.push({ id, title: `${bucket.name} (${bucket.count} flights)`, content: { type: "nonObject", nonObject: {} }, }); const bubble: IMrsRenderable = { id, sourcing: id, content: { bubble: { type: "geometry", geometry: { geometry: bucket.location, style: { symbol: { symbol: { type: "blueprint", blueprint: { id: "circle", color: { rgb: color, a: 180 }, }, }, size: 16 + 48 * scale, }, label: { text: `${code}: ${bucket.count}`, color: { rgb: "#FFFFFF", a: 255 }, size: 12, }, }, }, }, }, }; output.renderables.push(bubble); } return output; }
The function uses asyncIter() to process all pages of the input object set. Flights without a destination code or location are skipped. If no flights qualify, both output lists are empty. Bubble size uses a square-root scale, and color shows each group's size relative to the largest group: the smallest groups are green, followed by yellow and orange, while the largest groups are red. The bubbles show relative flight counts, not geographic coverage areas.

If your function does not appear in the Select Function list, check that: