Skip to content

RPC Functions

Functions from the SDK can be invoked via rpc.invoke().

Example usage

ts
import { rpc } from '@gi-nx/iframe-sdk';

// Invoke a function
rpc.invoke('setTiles', [sourceId, newTiles]);

// With await
const result = await rpc.invoke('getProjects', []);

Map & Navigation

FunctionDescription
addHtmlPopupNeeds Permission - Add an HTML popup to the map at a specific location.
addIframePopupNeeds Permission - LngLatLike and PopupOptions are mapbox gl types
clearSDKPopupClear/remove the current SDK popup from the map.
fitBoundsFit the map view to contain the specified bounds.
flyToAnimate the map camera to fly to a location.
getFeatureStateGet the current state of a Mapbox GL feature.
getMapBoundsGet the current map bounds as a GeoJSON FeatureCollection.
getMapStyleReturns the current Mapbox style object.
getQueriedFeatureGet the feature currently under the user's mouse cursor (hovered) or last clicked.
getSelectedFeaturesReturns the (raw) Giraffe features that are currently selected
loadImageLoad an image from a URL to mapbox, the key of which can be further referenced by styles.
queryRenderedFeaturesbase on https://docs.mapbox.com/mapbox-gl-js/api/map/#map#queryrenderedfeatures
removeFeatureStateNeeds Permission - Remove previously set state from a Mapbox GL feature.
setDrawToolSet the active drawing tool for map interactions.
setFeatureStateNeeds Permission - Set arbitrary state on a Mapbox GL feature.
setHighlightedFeaturesSet the highlighted features on the map.
setSelectedFeaturesSet the selected features by their IDs.

Layers

FunctionDescription
activateDrawingLayerNeeds Permission - The active drawing layer is the layer that any new geometry will be added to.
activateLensLayerNeeds Permission - Activate the lens for a layer.
addLayerToProjectNeeds Permission - Add the layer to the project.
addTempLayerNeeds Permission - add (or update the style of) a temporary (exists only for the current session/client) layer with a tiled source NB the source cannot be updated once the layer has been added, but the style can.
addTempLayerGeoJSONadd a temporary (exists only for the current session/client) layer with GeoJSON data source
createDrawingLayerNeeds Permission - Creates a new drawing layer with the given name.
createGeoJSONLayerNeeds Permission - Create a new GeoJSON layer from the provided data.
createLayerNeeds Permission - Create a layer with full configuration options.
deactivateLensLayerNeeds Permission - Close the lens panel and deselect the current lens layer.
deleteDrawingLayerNeeds Permission - Deletes a drawing layer and all associated sections.
deleteProjectLayerNeeds Permission - Removes a layer from the project.
duplicateDrawingLayerNeeds Permission - Duplicates a drawing layer and its associated sections.
getLayerContentsGet the layer contents filtered by lens and extent of the provided bounds.
getLayerPermissionGet the current user's permission for a layer (layer must be added to the current project).
removeTempLayerRemove a temporary layer from the map.
renameDrawingLayerNeeds Permission - Renames an existing drawing layer and updates all associated sections and analytics references.
setTilesNeeds Permission - Can be used by an app to override the source of a vector tile layer
updateGeoJSONLayerContentsNeeds Permission - Utility wrapper this uploads the geojson fc then calls patchLayer if layerName exists, otherwise createLayer then addProjectLayer.
updateLayerNeeds Permission - Update a layer's configuration (excluding vector source).
updateLayerStyleNeeds Permission - Update the style of a layer.
updateTempLayerGeoJSONupdate temporary layer data

Layer Tree

FunctionDescription
activateViewLayersNeeds Permission - Activate the layers of a view's layerTree and updates the sun position.
changeLayerOpacityNeeds Permission - Change the opacity of a layer.
changeLayerVisibilityNeeds Permission - Change the visibility of a layer.
createLayerGroupNeeds Permission - Create an empty group in the layer tree.
moveLayerTreeItemIntoGroupNeeds Permission - Move an item into a group.
removeLayerGroupNeeds Permission - Remove a group from the layer tree.
reorderLayerTreeItemNeeds Permission - Reorder any layer tree item or group.

Commands

FunctionDescription
getLensedFeatureMapGet all features from the currently active lens layer as a Map.

Blocks

FunctionDescription
createBlockNeeds Permission - Adds a new block definition to the project
deleteBlockNeeds Permission - Removes a block definition from the project.
getBlockReturns the block definition for the given id, or undefined if not found.
getBlocksReturns all block definitions, keyed by id.
insertBlockNeeds Permission - Prompts the user to click the map to place an instance of a block.
updateBlockNeeds Permission - Updates an existing block definition by merging the provided fields.

Flows

FunctionDescription
addFlowNeeds Permission - Adds a flow to the project.
deleteFlowNeeds Permission - Removes a flow from the project.
getNodeReturns the registered node definition for a given node instance id.
getParameterNodeReturns the parameter node associated with a generative transform node type.
getParameterNodeDefaultTransformReturns the default transform object for a given generative transform node type.
getProjectFlowsReturns all flows in the current project, keyed by their id.
NodeIdsNode ID constants for use with flow functions.
updateFlowsNeeds Permission - Updates flows by id.

Content Packs

FunctionDescription
addContentPackToProjectNeeds Permission - Fetches a content pack from url and imports its contents into the current project.
fetchContentPacksFetches all available content packs from the server.
fetchPackContentsFetches the contents of a specific content pack by its URL or file ID.

Engine

FunctionDescription
evaluateFeaturesEvaluates a set of raw sections against the current project state, producing pre-stacked sections keyed by feature ID.
stackFeaturesResolves stacking for pre-stacked sections.

Scenarios

FunctionDescription
activateScenarioActivate a scenario, making it the current working scenario.
deleteScenarioNeeds Permission - Delete a scenario from the project.
duplicateScenarioNeeds Permission - Duplicate a scenario, creating a copy with all its features.
getScenarioFeaturesGet all features belonging to a specific scenario.
getScenariosRetrieves all scenarios for the current project.
getVisibleScenariosGets the currently visible scenarios.
renameScenarioNeeds Permission - Renames a scenario.
setScenarioVisibilitySets the visibility of scenarios.
soloScenario

Project

FunctionDescription
createProjectAttachmentPromptOpen a file picker dialog for the user to upload a new project attachment.
createRawSectionNeeds Permission - create a Point, LineString or Polygon geometry that will be saved on Giraffe and that users can edit.
createRawSectionsNeeds Permission - Bulk method of createRawSection
deleteRawSectionNeeds Permission - Delete a raw section from the project.
deleteRawSectionsNeeds Permission - Delete multiple raw sections from the project.
fetchAppCredentialsFetch credentials for an app.
fetchCredentialsFetch credentials that both the current user and the current app have access to.
importRawSectionsNeeds Permission - Import RawSections into the current project, with options for usages, flows, etc.
openProjectOpen a project in a new browser tab.
selectProjectAttachmentPromptOpen a dialog for the user to select from existing project attachments.
updateProjectAppNeeds Permission - Update a project app configuration.
updateRawSectionNeeds Permission - Update an existing RawSection.
updateRawSectionsNeeds Permission - Same as updateRawSection but for many features.
uploadProjectAttachmentNeeds Permission - Upload a file as a project attachment.

Projects

FunctionDescription
createProjectNeeds Permission - Create a new project with the specified boundary polygon.
getProjectBundleGet the full project bundle including all sections, layers, and configuration.
getProjectsGet all projects in the current workspace as a FeatureCollection.
patchPropertiesNeeds Permission - Patch properties on multiple projects.
shareWithTeamNeeds Permission - Share projects with a team.
syncToProjectsUseful to bulk sync a list of projects/geometries from outside of Giraffe and make corresponding projects in Giraffe.
updateProjectNeeds Permission - Update a project's geometry or properties.

Utilities

FunctionDescription
addMapboxEventListeneradd a listener to mapbox events.
clearIsolatedFeaturesClear the isolated features and disable isolate mode if it was enabled.
disableBottomBarIframeDisable and hide the bottom bar iframe.
disableIsolateModeDisables isolate mode.
disableMapContentEventsif called, map content events (e.g. layer added, style updated, etc.) will no longer be dispatched to the SDK app.
disableMapHoverif called, mouse coordinates will no longer be dispatched to the SDK app.
disableSecondaryAppOverlayDisable the currently active secondary app overlay.
enableBottomBarIframeEnable a bottom bar iframe for displaying custom content.
enableIsolateModeEnables isolate mode.
enableMapContentEventsif called, map content events (e.g. layer added, style updated, etc.) will be dispatched to the SDK app. By default this is enabled.
enableMapHoverif called, mouse coordinates will be dispatched to the SDK app and can be accessed via the state key mapHoverCoords.
enableSecondaryAppOverlayEnable a secondary app overlay (Urban, Analytics, Solar, or Terrain).
featureAreaCalculate the area of a GeoJSON feature in square meters.
fetchProjectDetailsFetches details for a given project.
fetchUserFilesFetches files for the user.
fetchVistasFetches vistas for a project.
fromProjectedConvert local meter coordinates back to geographic coordinates (lng/lat).
getAnalyticsResultGet the analytics result for the current project.
getGeoTiffExport the current 2D map view as a GeoTiff image.
getGltfExport the current 3D scene as a GLTF model.
getIsolatedFeaturesGet the currently isolated features.
getIsolateModeCheck if isolate mode is enabled.
getPngExport the current map view as a PNG image.
getSourceLayerDetailsget layer info to pass to getVectorLayerContents from a layer in the base style eg roads
getTeamListGet the list of teams in the current organization.
getTempUrlGet a temporary URL for accessing files via storage proxy.
getTerrainMeshesGet the terrain meshes as a JSON string.
getTilesget the tile bounding boxes at a given zoom level covering the provided fc, used to start a GIS pipeline eg query or join per tile
getUrlParamsGet the current page URL and Giraffe routing context.
getUserClaimsJwtGet a JWT containing user claims for authentication with external services.
getUserDataGets the current user's meta data for a specific app.
getVectorLayerContentsGet the contents of a vector tile layer as GeoJSON.
navigateToNavigate to a different page.
readyToCloseSignal that the SDK app is ready to close.
removeMapboxEventListenerRemove a previously added Mapbox event listener.
setContextMenuItemsSet custom context menu items that appear on right-click.
setIsolatedFeaturesSet the features that should be isolated in isolate mode.
setTopViewSet the map camera mode to flat 2D or perspective 3D.
setUserDataNeeds Permission - Sets the current user's meta data for a specific app.
toProjectedConvert geographic coordinates (lng/lat) to local meters relative to an origin point.
updateUiLayoutUpdate UI layout settings (sidebar widths, visibility, etc.).

Select

FunctionDescription
drawPointPrompts the user to click on the map to place a point.
getLassoedProjectFeaturesPrompt the user to draw a lasso and return all project features within the selection.
getLassoShapePrompt the user to draw a freehand lasso shape on the map.
getSelectableProjectFeaturesGet all project features that are currently selectable on the map.
getUserDrawnPolygonPrompt the user to draw a polygon on the map.
pickRawSectionsPrompts the user to pick one or more raw sections from the map.

Usage

FunctionDescription
createUsageNeeds Permission - Create a new usage definition in the current project.
deleteUsageNeeds Permission - Delete a usage definition from the current project.
getProjectUsagesGet all usage definitions for the current project.
getUsageGet a single usage definition by name.
updateUsageNeeds Permission - Update an existing usage definition.