The src
directory contains the source code for the GEOComp react component creating the Lowcoder plugin. GEOComp providers configuration features for the GEO react component which renders an interactive geographic map using the OpenLayers library.
GEOComp is a reusable map component that can be configured and integrated into other applications. It allows displaying geographic data layers, interactivity through popups and drawing, and exposes events for integrating custom functionality.
Some key capabilities provided by GEOComp:
- Configurable base map layers
- Overlay vector data layers from files or API sources
- Interaction through popups, selection, and drawing tools
- Expose map events and selected features
- Timeline animation of temporal data
- Customizable styling
Within the main directory you will find the following files creating the lowcoder plugin
GEOComp.tsx
- Main component definition and configurationLayersControl.tsx
- Builds layer configuration UIFeaturesControl.tsx
- Feature flags configurationvendors/Geo.jsx
- The implementation of the GEO react componentstyles.module.css
- Component styling
GEOComp is configured through React props that control the map options and layers. Some key configuration props:
Map
layers
- Array of layer configuration objectslabel
- Display label for layertitle
- Layer menu texttype
- Layer type dropdown (mvt, wms, etc)source
- Layer source settingsurl
: The URL of the tile or image serviceattributions
: Attribution text for the layerparams
: Additional parameters for the service requestserverType
: The type of WMS server (geoserver, mapserver, etc)crossOrigin
: Whether to request cross-origin access when fetching the layerdata
: The GeoJSON data object for a vector layerprojection
: The projection of the vector datatileSize
: Tile size for COG layersnodata
: Nodata value to use for COG layersratio
: Scaling ratio for ArcGIS MapServer images
visible
- Is layer visible initiallyselectable
- Can layer be toggled on/offuserVisible
- Is layer visible to userorder
- Display order in layers listminZoom
- Minimum zoom level to show layermaxZoom
- Maximum zoom level to show layeropacity
- Layer opacitygroups
- Layer groupssplitscreen
- Split screen position (no, left, right)timeline
- Timeline year/date of layer
center
- Initial center point [lon, lat]zoom
- Initial zoom levelmaxZoom
- Initial maximum zoom levelminZoom
- Initial minimum zoom level
Interaction
events
- Object mapping event names to handlers
Menu
title
- Title used within menucontent
- Content of the menu usedfeature
- Selected/edited feature state
Timeline
Start Date
- Start Year/Date of the timelineEnd Date
- End Year/Date of the timeline
Style
- Padding
- Text sizing
- Background color
- Borders
- Border radius
Behavior
menu
- Whether to show the menu icon.zoom
- Show zoom buttons.fullscreen
- Show fullscreen toggle.layers
- Show layer visibility toggles.center
- Show map center button.modify
- Allow geometry editing.save
- Show save button.splitscreen
- Allow split screen.tracker
- Show tracker options.timeline
- Show timeline slider.gpsCentered
- Center map on user's location.north
- Show north button to reset bearing.scale
- Show map scale display.largeButtons
- Use large toolbar icons.scaleToBottom
- Put scale on bottom of toolbar."modify:move"
- Allow moving geometries."modify:point"
- Allow editing points."modify:line"
- Allow editing lines."modify:oval"
- Allow editing ovals."modify:polygon"
- Allow editing polygons."modify:delete"
- Show delete geometry button."modify:redo"
- Show redo button."modify:undo"
- Show undo button."splitscreen:horizontal"
- Allow horizontal split screen."splitscreen:vertical"
- Allow vertical split screen.debug
- Enable debug messages.
GEOComp exposes events that can be handled in the parent component:
onInit
- Map initializedonLoad
- Layers loadedonModify
- User modifies feature on maponTimeline
- User interacts with timelineonClick
- Map clickedonSelect
- Feature clickedonBbox
- The bbox of the map changedonEvent
- Eventhandler for all other events
This allows integrating custom popup content, selection logic, etc.
Perform animation
Parameters:
coords
(JSONValue): Coordinates for animationduration
(number): Duration of animationproperties
(JSON): Properties for featureanimation
(string): Type of animation (toLocation,toExtent,pulse,home)
Return the last map object
Parameters:
None
Notify message
Parameters:
message
(string): Notification messageduration
(number): Display duration
Displays a popup at the specified coordinates with a given message
Parameters:
coordinates
(JSONValue): Coordinates where the popup should appearmessage
(string): Message to display in the popup
Add feature to layer
Parameters:
data
(JSONValue): GeoJSON feature(s) to addlayer
(string): Layer nameclear
(boolean, optional): Clear layer first if true
Get features from layer
Parameters:
layer
(string): Layer name
Clear features from layer
Parameters:
layer
(string): Layer name
Set configuration the plugin by json
Parameters:
json
(JSONValue): Config objectfilter
(JSONValue): Layer Filter to apply
Get configuration the plugin by json
Parameters:
filter
(JSONValue): Layer Filter to apply