leaflet-geoserver-request
This is the leaflet plugin for GeoServer. Using this plugin user can have access to wms and wfs request easily.
Science Score: 54.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
✓CITATION.cff file
Found CITATION.cff file -
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
✓Academic publication links
Links to: zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (11.7%) to scientific vocabulary
Keywords
Repository
This is the leaflet plugin for GeoServer. Using this plugin user can have access to wms and wfs request easily.
Basic Info
- Host: GitHub
- Owner: iamtekson
- License: mit
- Language: JavaScript
- Default Branch: master
- Homepage: https://www.npmjs.com/package/leaflet-geoserver-request
- Size: 58.6 KB
Statistics
- Stars: 203
- Watchers: 5
- Forks: 32
- Open Issues: 3
- Releases: 4
Topics
Metadata Files
Readme.MD
Documentation leaflet-geoserver-request
This is the plugin for Geoserver various kind of requests. Using this plugin, we can make WMS, WFS, getLegendGraphic, WMS-Image request.
Video tutorial
Installation and setup
- using NPM:
js
npm install leaflet-geoserver-request
- Quick use :
html
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="[path to js]/L.Geoserver.js"></script>
Web-Map-Service (WMS) Request
WMS request will provides georeferenced map image.
js
var wmsLayer = L.Geoserver.wms("http://localhost:8080/geoserver/wms", {
layers: "topp:tasmania_roads",
});
wmsLayer.addTo(map);
WMS options
| Option | Type | Default | Description | | ----------- | ------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | layers | string | undefined | This is required filed. If you have multiple layers, you can add them in a comma seperated values: "workspace:layer1,workspace:layer2" | | format | string | image/png | formate of the wms request. It may be image/jpeg, image/tiff, application/openlayers | | transparent | boolean | true | transparent of the map | | CQL_FILTER | string | INCLUDE | To filter the layer based on their attribute. read more about this | | zIndex | integer | 1000 | zIndex of the layer | | attribution | string | layer | attribution of the layer. It will be added at the bottom-left cornor of the map | | style | string | undefined | style file associated with that layer. If you didn't provide the style field, it will take default style of the layer |
Web-Feature-Service (WFS) Request
In WFS request, you need to enable the jsonp for GeoServer. By default, jsonp for GeoServer was desabled. open $GEOSERVER_HOME\webapps\geoserver\WEB-INF\web.xml file and uncomment following line,
xml
<context-param>
<param-name>ENABLE_JSONP</param-name>
<param-value>true</param-value>
</context-param>
Note: WFS request only applicable for vector layer, not for raster
js
var wfsLayer = L.Geoserver.wfs("http://localhost:8080/geoserver/wfs", {
layers: "topp:tasmania_roads",
});
wfsLayer.addTo(map);
WFS options
| Options | Type | Default | Description | | ------------- | ------------------ | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------- | | layers | string | undefined | This is required filed. If you have multiple layers, you can add them in a comma seperated values: "workspace:layer1,workspace:layer2" | | style | js object/function | null | The style file can be in form of javascript oject or function. eg `style = {color: "black",fillOpacity: "0", opacity: "0.5" } | | onEachFeature | function | null | Common region to add this feature is to add popup when the layer cicked. more detail | | CQL_FILTER | string | INCLUDE | To filter the layer based on their attribute. read more about this | | fitLayer | boolean | true | The map automatically zoomed into the loaded data region |
Web-Mapping-Service-Image (WMSImage) request
This is the custom request naming by me. It will generate the image which will zoomed to the desired location. The main different between wms and wmsImage request is, it can be zoomed to the desired location based on vector layer.
There are certain convention for this request. Please read carefully
The first layer must be vector layer in option
wmsLayers. Rest of other layers can be vector or rasterYou need to provide the same number of data list in
wmsLayers,wmsCQL_FILTER&wmsStylefieldsThe map will zoomed to the first parameter of
wmsCQL_FILTERregionThe default value for the style and cql_filter will be include
The wmsLayers and wmsId fields are required field
html
<img src="" id="wmsImage" />
<!-- The id field is required. This id will used in js script option "wmsId"-->
js
L.Geoserver.wmsImage("http://localhost:8080/geoserver/wms", {
wmsLayers: [
"workspace:first_layer",
"workspace:second_layer",
"workspace:third_layer",
],
wmsCQL_FILTER: ["district=='Syangja'", "INCLUDE", "INCLUDE"],
wmsStyle: ["style1", "style2", "INCLUDE"],
format: "image/png",
wmsId: "wmsImage",
width: 300,
height: 300,
});
Legend Request
The legend request will provide the crossponding legend of the layer to the bottom-left position of the map. In case of not providing style parameter, it will take the default style from GeoServer.
``js
var layerLegend = L.Geoserver.legend("http://localhost:8080/geoserver/wms", {
layers: "topp:tasmania_roads",
style:stylefile`,
});
layerLegend.addTo(map); ```
Advance WFS request demo
```js var wfsLayerAdvance = L.Geoserver.wfs("http://localhost:8080/geoserver/wms", { layers: "topp:tasmaniaroads", style: { color: "black", fillOpacity: "0", opacity: "0.5", }, onEachFeature: function (feature, layer) { layer.bindPopup("this is popuped"); }, CQLFILTER: "district='Syangja'", });
map.fitBounds(wfsLayerAdvance.getBounds()); wfsLayerAdvance.addTo(map); ```
Contribution:
Would :heart: to see any contributions.
Appreciate:
If you liked my work, show some :heart: by :star: repo.
Also you can appreciate by
|
|
Owner
- Name: Tek Kshetri
- Login: iamtekson
- Kind: user
- Location: Nepal
- Company: Geoscience Department, University of Calgary, Canada
- Website: https://www.youtube.com/iamtekson
- Twitter: iamtekson
- Repositories: 13
- Profile: https://github.com/iamtekson
Geospatial researcher | Web-GIS | FOSS4G Developer | Spatial Data Analyst | YouTuber
Citation (CITATION.cff)
cff-version: 1.1.0
message: "If you use this software, please cite it as below."
authors:
- family-names: Kshetri
given-names: Tek
orcid: https://orcid.org/0000-0001-9275-5619
title: iamtekson/leaflet-geoserver-request: V1.3.0
version: v1.3.0
date-released: 2017-12-18
GitHub Events
Total
- Watch event: 7
- Issue comment event: 1
Last Year
- Watch event: 7
- Issue comment event: 1
Committers
Last synced: almost 3 years ago
Top Committers
| Name | Commits | |
|---|---|---|
| iamtekson | i****n@g****m | 22 |
| Tek Kshetri | 3****n@u****m | 19 |
| iamtekson | t****a@g****m | 5 |
| Hassan Basri | 5****s@u****m | 4 |
| Antonio V | a****x@g****m | 1 |
| João Paulo Polles | j****s@g****m | 1 |
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 9
- Total pull requests: 11
- Average time to close issues: 7 months
- Average time to close pull requests: about 21 hours
- Total issue authors: 8
- Total pull request authors: 5
- Average comments per issue: 1.33
- Average comments per pull request: 0.45
- Merged pull requests: 11
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 1
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 1
- Pull request authors: 0
- Average comments per issue: 0.0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- oldwired (2)
- vincedchart (1)
- dameattrio (1)
- nez (1)
- mylesmc123 (1)
- ShammyLevva (1)
- OculiViridi (1)
- Rafiosan (1)
Pull Request Authors
- iamtekson (7)
- Snailedlt (1)
- mrzh4s (1)
- antoniovlx (1)
- jppcel (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 2
-
Total downloads:
- npm 1,591 last-month
-
Total dependent packages: 2
(may contain duplicates) -
Total dependent repositories: 4
(may contain duplicates) - Total versions: 14
- Total maintainers: 1
npmjs.org: leaflet-geoserver-request
This is the library for wms, wfs, legend, wmsImage request from geoserver to leaflet.
- Homepage: https://github.com/iamtekson/leaflet-geoserver-request#readme
- License: ISC
-
Latest release: 1.3.0
published almost 3 years ago
Rankings
Maintainers (1)
proxy.golang.org: github.com/iamtekson/leaflet-geoserver-request
- Documentation: https://pkg.go.dev/github.com/iamtekson/leaflet-geoserver-request#section-documentation
- License: mit
-
Latest release: v1.3.0
published almost 3 years ago
Rankings
Dependencies
- jquery ^3.5.1 development
- leaflet ^1.6.0 development
