{"id":20514839,"url":"https://github.com/flexberry/leaflet-wfst","last_synced_at":"2025-04-05T09:09:25.040Z","repository":{"id":22968902,"uuid":"26318829","full_name":"Flexberry/Leaflet-WFST","owner":"Flexberry","description":"OGC WFS-T client layer for Leaflet.","archived":false,"fork":false,"pushed_at":"2024-04-19T10:23:30.000Z","size":1327,"stargazers_count":152,"open_issues_count":25,"forks_count":50,"subscribers_count":38,"default_branch":"master","last_synced_at":"2025-03-29T08:06:08.990Z","etag":null,"topics":["gis","leaflet","leaflet-layer","wfs"],"latest_commit_sha":null,"homepage":"http://flexberry.github.io/Leaflet-WFST/","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Flexberry.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-07T12:28:00.000Z","updated_at":"2025-02-20T04:33:20.000Z","dependencies_parsed_at":"2023-02-16T07:45:43.213Z","dependency_job_id":"a70e85b0-5bca-45b5-99e2-3b9849ee41fe","html_url":"https://github.com/Flexberry/Leaflet-WFST","commit_stats":{"total_commits":195,"total_committers":9,"mean_commits":"21.666666666666668","dds":"0.40512820512820513","last_synced_commit":"b4e92d49bb035a1c7095f9dc049e52fcc5a25202"},"previous_names":[],"tags_count":41,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flexberry%2FLeaflet-WFST","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flexberry%2FLeaflet-WFST/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flexberry%2FLeaflet-WFST/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Flexberry%2FLeaflet-WFST/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Flexberry","download_url":"https://codeload.github.com/Flexberry/Leaflet-WFST/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312082,"owners_count":20918344,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["gis","leaflet","leaflet-layer","wfs"],"created_at":"2024-11-15T21:18:27.553Z","updated_at":"2025-04-05T09:09:24.983Z","avatar_url":"https://github.com/Flexberry.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Leaflet-WFST\n[![Build Status](https://travis-ci.org/Flexberry/Leaflet-WFST.svg?branch=master)](https://travis-ci.org/Flexberry/Leaflet-WFST)\n\nOGC WFS-T client layer for leaflet.\n\n# Install plugin\nVia [npm](https://www.npmjs.com/):\n```\n  npm i leaflet-wfst --save\n```\nVia [Bower](https://bower.io/):\n```\n  bower i leaflet-wfst --save\n```\nFrom [GitHub](https://github.com/):\n```\n  npm i -S git://github.com/Flexberry/Leaflet-WFST.git#v1.1.1\n```\nwhere #v1.1.1 is version of specific [release](https://github.com/Flexberry/Leaflet-WFST/releases).\n\n# Initialization options\n\n```javascript\n   options: {\n        crs: L.CRS.EPSG3857,\n        showExisting: true,\n        geometryField: 'Shape',\n        url: '',\n        typeNS: '',\n        typeName: '',\n        opacity: 1,\n        style: {\n            color: 'black',\n            weight: 1\n        }\n    }\n\n```\n\n## Example\n```javascript\nconst wfstPointOptions = {\n  crs: L.CRS.EPSG4326,\n  showExisting: true,\n  geometryField: 'geom',\n  url: `http://localhost:8080/geoserver/wfs`,\n  typeNS: 'test',\n  typeName: 'test',\n  maxFeatures: 90,\n  opacity: 1,\n  style: function(layer) {\n    // you can use if statemt etc\n    return {\n      color: 'black',\n      weight: 1\n    }\n  },\n};\nconst wfstPoint = new L.WFST(wfstPointOptions, new L.Format.GeoJSON({\n  crs: L.CRS.EPSG4326,\n  pointToLayer(geoJsonPoint, latlng) {\n    const layer = new L.CircleMarker(latlng, {\n      radius: 10,\n    });\n    return layer;\n  },\n}));\nwfstPoint.addTo(map);\n```\n\n|option name|default|comment|\n|-----------|-------|-------|\n|crs|L.CRS.EPSG3857|spatial reference system for layer, should implement [ICRS](http://leafletjs.com/reference.html#icrs), for example [Proj4Leaflet](https://github.com/kartena/Proj4Leaflet) |\n|showExisting|true|load existing features on create layer|\n|geometryField|'Shape'|field for storing geometries, for non transaction services may be ommited|\n|url|-|WFS url, for example http://demo.opengeo.org/geoserver/osm/ows\n|typeNS|-|type namespace|\n|typeName|-|type name|\n|typeNSName|-|type namespace name|\n|namespaceUri|-|namespace URI|\n|opacity|1|layer's opacity|\n|style|-|leaflet vector style. function or object|\n|filter|-|any filter. see [filter](#filter)|\n|maxFeatures|-|limit the amount of features returned|\n\n# Basic WFS example - [view](http://flexberry.github.io/Leaflet-WFST/examples/tasmania.html)\n```javascript\nvar map = L.map('map').setView([0, 0], 2);\n\nvar boundaries = new L.WFS({\n    url: 'http://demo.opengeo.org/geoserver/ows',\n    typeNS: 'topp',\n    typeName: 'tasmania_state_boundaries',\n    crs: L.CRS.EPSG4326,\n    style: {\n        color: 'blue',\n        weight: 2\n    }\n}).addTo(map)\n  .on('load', function () {\n      map.fitBounds(boundaries);\n  })\n```\n\n# Methods\nExtends leaflet classes with toGml(crs) function:\n* L.Marker\n* L.Polygon\n* L.Polyline\n* L.MultiPolygon\n* L.MultiPolyline\n* L.LatLngBounds\n\n# Events\nTriggers two type of events:\n* load - triggers when both 'DescribeFeatureType' \u0026 'GetFeature' requests succeed, and features have been successfully parsed into leaflet layers\n* error - triggers when any 'DescribeFeatureType' or 'GetFeature' request fails, and features haven't been parsed into leaflet layers\n\nMarkers geometry writes as posNode, for all other layers geometry writes as posList\n\n# Filter\n\nRealization of OGC Filter Encoding v1.1.0\n\nFilter implementations return only inner content of filter element.\n\nSome considerations for all filter constructors:\n* \"expression\" - propertyName, literal, operator filter or function\n* \"propertyExpression\" - if argument on this position is not Element and is not \"expression\" method it suspect to be a propertyName\n* \"literalExpression\" - if argument on this position is not Element and is not \"expression\" it suspect to be a literal\n\n|Name|Constructor|\n|----|-----|\n|**ID**|\n|[GmlObjectId](#featureid)|L.Filter.GmlObjectId(value id)|\n|**Comparisons**|\n|[PropertyIsEqualTo](#propertyisequalto)|L.Filter.EQ(propertyExpression firstArgument, literalExpression secondArgument, bool matchCase)|\n|PropertyIsNotEqualTo|L.Filter.NotEQ(propertyExpression firstArgument, literalExpression secondArgument, bool matchCase)|\n|PropertyIsLessThan|L.Filter.LT(propertyExpression firstArgument, literalExpression secondArgument, bool matchCase)|\n|PropertyIsGreaterThan|L.Filter.GT(propertyExpression firstArgument, literalExpression secondArgument, bool matchCase)|\n|PropertyIsLessThanOrEqualTo|L.Filter.LEQ(propertyExpression firstArgument, literalExpression secondArgument, bool matchCase)|\n|PropertyIsGreaterThanOrEqualTo|L.Filter.GEQ(propertyExpression firstArgument, literalExpression secondArgument, bool matchCase)|\n|[PropertyIsLike](#propertyislike)|L.Filter.Like(string propertyName,string likeExpression,object attributes)|\n|PropertyIsNull|L.Filter.IsNull(string propertyName)|\n|PropertyIsBetween|L.Filter.IsBetween(propertyExpression firstArgument, literalExpression lowerBoundary, literalExpression upperBoundary)|\n|**Operators**|\n|Add|L.Filter.Add(expression, expression)|\n|Sub|L.Filter.Sub(expression, expression)|\n|Mul|L.Filter.Mul(expression, expression)|\n|Div|L.Filter.Div(expression, expression)|\n|**Logic**|\n|And|L.Filter.And(expression[, expression]*)|\n|Or|L.Filter.Or(expression[, expression]*)|\n|Not|L.Filter.Not(expression)|\n|**Spatial**|\n|[BBox](#bbox)|L.Filter.BBox(string propertyName, latLngBounds bounds, ICRS crs)|\n|Equals|L.Filter.Equals(string propertyName, Layer geometry, ICRS crs)|\n|Disjoint|L.Filter.Disjoint(string propertyName, Layer geometry, ICRS crs)|\n|Touches|L.Filter.Touches(string propertyName, Layer geometry, ICRS crs)|\n|Within|L.Filter.Within(string propertyName, Layer geometry, ICRS crs)|\n|Overlaps|L.Filter.Overlaps(string propertyName, Layer geometry, ICRS crs)|\n|Crosses|L.Filter.Crosses(string propertyName, Layer geometry, ICRS crs)|\n|[Intersects](#intersects)|L.Filter.Intersects(string propertyName, Layer geometry, ICRS crs)|\n|Contains|L.Filter.Contains(string propertyName, Layer geometry, ICRS crs)|\n|**Spatial distance buffer**|\n|DWithin|L.Filter.DWithin(string propertyName, Layer geometry, ICRS crs, value distance, string units)|\n|Beyond|L.Filter.Beyond(string propertyName, Layer geometry, ICRS crs, value distance, string units)|\n|**Other**|\n|Function|L.Filter.Function(string functionName[, expression]*)|\n|PropertyName|L.Filter.propertyName(string name)|\n|Literal|L.Filter.literal(value)|\n\n*PropertyName and Literal is functions and returns Gml directly.*\n\n## Examples\n\n### FeatureID \n\nIn standard there are two filters - GmlObjectID and FeatureID, but latest is marked as deprecated and so is not implemented.   \n\nExample:\n```javascript\n  var filter = new L.Filter.GmlObjectID(1);  \n```\nresult xml:\n```xml\n  \u003cogc:Filter xmlns:ogc=\"http://www.opengis.net/ogc\"\u003e\n    \u003cogc:GmlObjectId xmlns:gml=\"http://www.opengis.net/gml\" gml:id=\"1\" /\u003e\n  \u003c/ogc:Filter\u003e\n```\n\n### PropertyIsEqualTo\n\n```javascript\n  var filter = new L.Filter.EQ('city', 'Perm');\n  filter.toGml()\n```\n\nresult xml:\n```xml\n  \u003cogc:PropertyIsEqualTo\u003e\n    \u003cogc:PropertyName\u003ecity\u003c/ogc:PropertyName\u003e\n    \u003cogc:Literal\u003ePerm\u003c/ogc:Literal\u003e\n  \u003c/ogc:PropertyIsEqualTo\u003e\n```\n\n### PropertyIsLike\n\nThis filter accept optional attributes object:\n```javascript\n attributes: {\n    wildCard: '*',\n    singleChar: '#',\n    escapeChar: '!',\n    matchCase: true\n  }\n```\n\n```javascript\n  var filter = new L.Filter.Like('city', '*perm*', { matchCase: false });\n  filter.toGml()\n```\n\nresult xml:\n```xml\n  \u003cogc:ogc:PropertyIsLike wildCard=\"*\" singleChar=\"#\" escapeChar=\"!\" matchCase=\"false\"\u003e\n    \u003cogc:PropertyName\u003ecity\u003c/ogc:PropertyName\u003e\n    \u003cogc:Literal\u003e*perm*\u003c/ogc:Literal\u003e\n  \u003c/ogc:ogc:PropertyIsLike\u003e\n```\n\n### BBox \n\nExample:\n```javascript\n    var filter = new L.Filter.BBox('ogr_geometry', L.latLngBounds(L.latLng(40.712, -74.227), L.latLng(40.774, -74.125)), L.CRS.EPSG4326);\n    filter.toGml()\n```\n\nresult xml:\n```xml\n  \u003cogc:Filter xmlns:ogc=\"http://www.opengis.net/ogc\"\u003e\n    \u003cogc:BBOX\u003e\n      \u003cogc:PropertyName\u003eogr_geometry\u003c/ogc:PropertyName\u003e\n      \u003cgml:Envelope xmlns:gml=\"http://www.opengis.net/gml\" srsName=\"EPSG:4326\"\u003e\n        \u003cgml:lowerCorner\u003e-74.227 40.712\u003c/gml:lowerCorner\u003e\n        \u003cgml:upperCorner\u003e-74.125 40.774\u003c/gml:upperCorner\u003e\n      \u003c/gml:Envelope\u003e\n    \u003c/ogc:BBOX\u003e\n  \u003c/ogc:Filter\u003e\n```\n\n### Intersects\n\nExample:\n```javascript\n  var filter = new L.Filter.Intersects('ogr_geometry', L.polygon([L.latLng(40.712, -74.227), L.latLng(40.774, -74.125), L.latLng(40.734, -74.175)]), L.CRS.EPSG4326);\n  filter.toGml();\n```\nresult xml:\n```xml\n  \u003cogc:Filter xmlns:ogc=\"http://www.opengis.net/ogc\"\u003e\n    \u003cogc:Intersects\u003e\n      \u003cogc:PropertyName\u003eogr_geometry\u003c/ogc:PropertyName\u003e\n      \u003cgml:Polygon xmlns:gml=\"http://www.opengis.net/gml\" srsName=\"EPSG:4326\" srsDimension=\"2\"\u003e\n        \u003cgml:exterior\u003e\n          \u003cgml:LinearRing srsDimension=\"2\"\u003e\n            \u003cgml:posList\u003e-74.227 40.712 -74.125 40.774 -74.175 40.734 -74.227 40.712\u003c/gml:posList\u003e\n          \u003c/gml:LinearRing\u003e\n        \u003c/gml:exterior\u003e\n      \u003c/gml:Polygon\u003e\n    \u003c/ogc:Intersects\u003e\n  \u003c/ogc:Filter\u003e\n```\n\n# WFST Example\nEditing plugin - [Leaflet.Editable](https://github.com/yohanboniface/Leaflet.Editable)\n```javascript\nL.WFST.include(MultiEditableMixin);\n\nvar wfst = new L.WFST({\n    url: 'http://myserver/geoserver/ows',\n    typeNS: 'myns',\n    typeName: 'POIPOINT',\n    style: {\n        color: 'blue',\n        weight: 2\n    }\n}).addTo(map).once('load', function () {\n            map.fitBounds(wfst);\n            wfst.enableEdit();\n        });\n\nmap.on('editable:created', function (e) {\n    wfst.addLayer(e.layer);\n});\n\nmap.on('editable:editing', function (e) {\n    wfst.editLayer(e.layer);\n});\n```\n\nto make \"wfs:Transaction\" POST request call save() method, example with [Leaflet.EasyButton](https://github.com/CliffCloud/Leaflet.EasyButton)\n```javascript\n L.easyButton('fa-save', function () {\n     wfst.save();\n }, 'Save changes');\n```\n\n# Layer properties\n```javascript\n//simple layer\nlayer = new L.Marker([0, 0]);\nlayer.feature = {\n  id: 1,\n  properties: {\n    a: 'a',\n    b: 'b'\n  }\n};\n\n//get value by key 'a'\nvar a = layer.getProperty('a');\n\n//change values\nlayer.setProperties({\n  a: 'b',\n  b:'a'\n});\n\n//add new property\nlayer.setProperties({\n  c:'c'\n});\n\n//delete properties\nlayer.deleteProperties(['a','b','c']);\n```\n\n# Demo\ndemos for GML read format\n* [Markers](http://flexberry.github.io/Leaflet-WFST/examples/markers.html)\n* [Polygons](http://flexberry.github.io/Leaflet-WFST/examples/polygon.html)\n* [Polylines](http://flexberry.github.io/Leaflet-WFST/examples/polyline.html)\n\ndemo for GeoJSON read format\n* [Polygons](http://flexberry.github.io/Leaflet-WFST/examples/polygonGeoJSON.html)\n\ndemo filter bbox\n* [BBox](http://flexberry.github.io/Leaflet-WFST/examples/filterBBox.html)\n\n# License\n[MIT License](https://github.com/Flexberry/Leaflet-WFST/blob/master/LICENSE.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexberry%2Fleaflet-wfst","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflexberry%2Fleaflet-wfst","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflexberry%2Fleaflet-wfst/lists"}