|
1 |
| -# GEOComp Component |
| 1 | +# Using the Lowcoder GEO plugin |
2 | 2 |
|
3 |
| -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. |
| 3 | +This plugin enables the usage of [Openlayers](https://openlayers.org/) within lowcoder. To use this plugin. |
4 | 4 |
|
5 |
| -## Overview |
| 5 | +1. Open your lowcoder environment >> go to the app >> Select insert tab click on extentions. |
6 | 6 |
|
7 |
| -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. |
| 7 | + |
8 | 8 |
|
9 |
| -Some key capabilities provided by GEOComp: |
| 9 | +2. write the name of the npm package, for the our extentions will be : `lowcoder-comp-geo` or the full url of the package `https://www.npmjs.com/package/lowcoder-comp-geo` |
10 | 10 |
|
11 |
| -- Configurable base map layers |
12 |
| -- Overlay vector data layers from files or API sources |
13 |
| -- Interaction through popups, selection, and drawing tools |
14 |
| -- Expose map events and selected features |
15 |
| -- Timeline animation of temporal data |
16 |
| -- Customizable styling |
| 11 | + |
17 | 12 |
|
18 |
| -## Key Files |
| 13 | +3. Drag and drop the `geo` component, Start using the plugin adding different type of layers like : |
| 14 | + - GeoJSON |
| 15 | + - Cloud Optimized GeoTIFF (COG) |
| 16 | + - PMTiles (Raster and Vector) |
| 17 | + - XYZ |
| 18 | + - WMS |
| 19 | + - WFS |
| 20 | + - Mapbox Vector Tiles ({z}/{x}/{y}.pbf) |
| 21 | + - Mapbox Style GL Json |
| 22 | + - ArcGIS FeatureServer (with Esri Style) |
| 23 | + - ArcGIS MapServer |
| 24 | + - ArcGIS ImageServer |
| 25 | + - ArcGIS TileServer |
| 26 | + - ArcGIS VectorTileServer (with Esri Style) |
19 | 27 |
|
20 |
| -Within the main directory you will find the following files creating the lowcoder plugin |
| 28 | + |
21 | 29 |
|
22 |
| -- `GEOComp.tsx` - Main component definition and configuration |
23 |
| -- `LayersControl.tsx` - Builds layer configuration UI |
24 |
| -- `FeaturesControl.tsx` - Feature flags configuration |
25 |
| -- `vendors/Geo.jsx` - The implementation of the GEO react component |
26 |
| -- `styles.module.css` - Component styling |
| 30 | +# Documentation |
27 | 31 |
|
28 |
| -## Component Configuration |
| 32 | +The ui of the plugin should be more or less self explaining. If you want a basic explanation of all switches and settings look at the [tutorial](https://sjhoeksma.github.io/lowcoder-comp-geo/#/tutorial) |
29 | 33 |
|
30 |
| -GEOComp is configured through React props that control the map options and layers. Some key configuration props: |
| 34 | +# Example |
31 | 35 |
|
32 |
| -Map |
33 |
| -- `layers` - Array of layer configuration objects |
34 |
| - - `label` - Display label for layer |
35 |
| - - `title` - Layer menu text |
36 |
| - - `type` - Layer type dropdown (mvt, wms, etc) |
37 |
| - - `source` - Layer source settings |
38 |
| - - `url`: The URL of the tile or image service |
39 |
| - - `attributions`: Attribution text for the layer |
40 |
| - - `params`: Additional parameters for the service request |
41 |
| - - `serverType`: The type of WMS server (geoserver, mapserver, etc) |
42 |
| - - `crossOrigin`: Whether to request cross-origin access when fetching the layer |
43 |
| - - `data`: The GeoJSON data object for a vector layer |
44 |
| - - `projection`: The projection of the vector data |
45 |
| - - `tileSize`: Tile size for COG layers |
46 |
| - - `nodata`: Nodata value to use for COG layers |
47 |
| - - `ratio`: Scaling ratio for ArcGIS MapServer images |
48 |
| - - `visible` - Is layer visible initially |
49 |
| - - `selectable` - Can layer be toggled on/off |
50 |
| - - `userVisible` - Is layer visible to user |
51 |
| - - `order` - Display order in layers list |
52 |
| - - `minZoom` - Minimum zoom level to show layer |
53 |
| - - `maxZoom` - Maximum zoom level to show layer |
54 |
| - - `opacity` - Layer opacity |
55 |
| - - `groups` - Layer groups |
56 |
| - - `splitscreen` - Split screen position (no, left, right) |
57 |
| - - `timeline` - Timeline year/date of layer |
58 |
| -- `center` - Initial center point [lon, lat] |
59 |
| -- `zoom` - Initial zoom level |
60 |
| -- `maxZoom` - Initial maximum zoom level |
61 |
| -- `minZoom` - Initial minimum zoom level |
| 36 | +To help you with understanding how you can use this plugin we have added an <a href='https://sjhoeksma.github.io/lowcoder-comp-geo/lowcoder-example/lowcoder-comp-geo.json' download="lowcoder-comp-geo.json">example application</a>. Just download the json application file and import it within lowcoder or follow the instructions step by step in our [tutorial]() |
62 | 37 |
|
63 |
| -Interaction |
64 |
| -- `events` - Object mapping event names to handlers |
| 38 | +#### Viewer |
65 | 39 |
|
66 |
| -Menu |
67 |
| -- `title` - Title used within menu |
68 |
| -- `content` - Content of the menu used |
69 |
| -- `feature` - Selected/edited feature state |
70 |
| - |
71 |
| -Timeline |
72 |
| -- `Start Date` - Start Year/Date of the timeline |
73 |
| -- `End Date` - End Year/Date of the timeline |
74 |
| - |
75 |
| -Style |
76 |
| -- Padding |
77 |
| -- Text sizing |
78 |
| -- Background color |
79 |
| -- Borders |
80 |
| -- Border radius |
81 |
| - |
82 |
| -Behavior |
83 |
| -- `menu` - Whether to show the menu icon. |
84 |
| -- `zoom` - Show zoom buttons. |
85 |
| -- `fullscreen` - Show fullscreen toggle. |
86 |
| -- `layers` - Show layer visibility toggles. |
87 |
| -- `center` - Show map center button. |
88 |
| -- `modify` - Allow geometry editing. |
89 |
| -- `save` - Show save button. |
90 |
| -- `splitscreen` - Allow split screen. |
91 |
| -- `tracker` - Show tracker options. |
92 |
| -- `timeline` - Show timeline slider. |
93 |
| -- `gpsCentered` - Center map on user's location. |
94 |
| -- `north` - Show north button to reset bearing. |
95 |
| -- `scale` - Show map scale display. |
96 |
| -- `largeButtons` - Use large toolbar icons. |
97 |
| -- `scaleToBottom` - Put scale on bottom of toolbar. |
98 |
| -- `"modify:move"` - Allow moving geometries. |
99 |
| -- `"modify:point"` - Allow editing points. |
100 |
| -- `"modify:line"` - Allow editing lines. |
101 |
| -- `"modify:oval"` - Allow editing ovals. |
102 |
| -- `"modify:polygon"` - Allow editing polygons. |
103 |
| -- `"modify:delete"` - Show delete geometry button. |
104 |
| -- `"modify:redo"` - Show redo button. |
105 |
| -- `"modify:undo"` - Show undo button. |
106 |
| -- `"splitscreen:horizontal"` - Allow horizontal split screen. |
107 |
| -- `"splitscreen:vertical"` - Allow vertical split screen. |
108 |
| -- `debug` - Enable debug messages. |
109 |
| - |
110 |
| - |
111 |
| -## Events and Interactivity |
112 |
| - |
113 |
| -GEOComp exposes events that can be handled in the parent component: |
114 |
| - |
115 |
| -- `onInit` - Map initialized |
116 |
| -- `onLoad` - Layers loaded |
117 |
| -- `onModify` - User modifies feature on map |
118 |
| -- `onTimeline` - User interacts with timeline |
119 |
| -- `onClick` - Map clicked |
120 |
| -- `onSelect` - Feature clicked |
121 |
| -- `onBbox` - The bbox of the map changed |
122 |
| -- `onZoom` - Fires when the zoom has changed |
123 |
| -- `onEvent` - Eventhandler for all other events |
124 |
| - |
125 |
| -This allows integrating custom popup content, selection logic, etc. |
126 |
| - |
127 |
| -## Exposed Methods |
128 |
| - |
129 |
| -### animate |
130 |
| - |
131 |
| -Perform animation |
132 |
| - |
133 |
| -**Parameters:** |
134 |
| - |
135 |
| -- `coords` (JSONValue): Coordinates for animation |
136 |
| -- `duration` (number): Duration of animation |
137 |
| -- `properties` (JSON): Properties for feature |
138 |
| -- `animation` (string): Type of animation (toLocation,toExtent,pulse,home) |
139 |
| - |
140 |
| -### map |
141 |
| - |
142 |
| -Return the last map object |
143 |
| - |
144 |
| -**Parameters:** |
145 |
| - |
146 |
| -None |
147 |
| - |
148 |
| -### notify |
149 |
| - |
150 |
| -Notify message |
151 |
| - |
152 |
| -**Parameters:** |
153 |
| - |
154 |
| -- `message` (string): Notification message |
155 |
| -- `duration` (number): Display duration |
156 |
| - |
157 |
| -### showPopup |
158 |
| - |
159 |
| -Displays a popup at the specified coordinates with a given message |
160 |
| - |
161 |
| -**Parameters:** |
162 |
| - |
163 |
| -- `coordinates` (JSONValue): Coordinates where the popup should appear |
164 |
| -- `message` (string): Message to display in the popup |
165 |
| - |
166 |
| -### setFeatures |
167 |
| - |
168 |
| -Add feature to layer |
169 |
| - |
170 |
| -**Parameters:** |
171 |
| - |
172 |
| -- `data` (JSONValue): GeoJSON feature(s) to add |
173 |
| -- `layer` (string): Layer name |
174 |
| -- `clear` (boolean, optional): Clear layer first if true |
175 |
| - |
176 |
| -### getFeatures |
177 |
| - |
178 |
| -Get features from layer |
179 |
| - |
180 |
| -**Parameters:** |
181 |
| - |
182 |
| -- `layer` (string): Layer name |
183 |
| - |
184 |
| -### clearFeatures |
185 |
| - |
186 |
| -Clear features from layer |
187 |
| - |
188 |
| -**Parameters:** |
189 |
| - |
190 |
| -- `layer` (string): Layer name |
191 |
| - |
192 |
| -### setConfig |
193 |
| - |
194 |
| -Set configuration the plugin by json |
195 |
| - |
196 |
| -**Parameters:** |
197 |
| - |
198 |
| -- `json` (JSONValue): Config object |
199 |
| -- `filter` (JSONValue): Layer Filter to apply |
200 |
| - |
201 |
| -### getConfig |
202 |
| - |
203 |
| -Get configuration the plugin by json |
204 |
| - |
205 |
| -**Parameters:** |
206 |
| - |
207 |
| -- `filter` (JSONValue): Layer Filter to apply |
| 40 | + |
0 commit comments