forked from geosolutions-it/MapStore2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Part of geosolutions-it#1885. Add basic update and delete functionali…
…ties with fid filter
- Loading branch information
1 parent
5df8a48
commit afa99d6
Showing
12 changed files
with
89 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<wfs:Transaction service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-transaction.xsd" xmlns:tiger="http://www.census.gov"><wfs:Delete typeName="tiger:poi"><ogc:Filter><ogc:FeatureId fid="poi.1"/></ogc:Filter></wfs:Delete></wfs:Transaction> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<wfs:Transaction service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-transaction.xsd" xmlns:topp="http://www.openplans.org/topp"><wfs:Insert><topp:states><topp:STATE_NAME>Wyoming</topp:STATE_NAME><topp:STATE_FIPS>56</topp:STATE_FIPS><topp:SUB_REGION>Mtn</topp:SUB_REGION><topp:STATE_ABBR>WY</topp:STATE_ABBR><topp:LAND_KM>251500.801</topp:LAND_KM><topp:WATER_KM>1848.149</topp:WATER_KM><topp:PERSONS>453588</topp:PERSONS><topp:FAMILIES>119825</topp:FAMILIES><topp:HOUSHOLD>168839</topp:HOUSHOLD><topp:MALE>227007</topp:MALE><topp:FEMALE>226581</topp:FEMALE><topp:WORKERS>164561</topp:WORKERS><topp:DRVALONE>153679</topp:DRVALONE><topp:CARPOOL>28109</topp:CARPOOL><topp:PUBTRANS>2963</topp:PUBTRANS><topp:EMPLOYED>207868</topp:EMPLOYED><topp:UNEMPLOY>13112</topp:UNEMPLOY><topp:SERVICE>71419</topp:SERVICE><topp:MANUAL>29157</topp:MANUAL><topp:P_MALE>0.5</topp:P_MALE><topp:P_FEMALE>0.5</topp:P_FEMALE><topp:SAMP_POP>83202</topp:SAMP_POP><topp:the_geom><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon srsName="EPSG:4326"><gml:exterior><gml:LinearRing><gml:posList>-104.053108 41.698246 -104.054993 41.564247 -104.053505 41.388107 -104.051201 41.003227 -104.933968 40.994305 -105.278259 40.996365 -106.202896 41.000111 -106.328545 41.001316 -106.864838 40.998489 -107.303436 41.000168 -107.918037 41.00341 -109.047638 40.998474 -110.001457 40.997646 -110.062477 40.99794 -111.050285 40.996635 -111.050911 41.25848 -111.050323 41.578648 -111.047951 41.996265 -111.046028 42.503323 -111.048447 43.019962 -111.04673 43.284813 -111.045998 43.515606 -111.049629 43.982632 -111.050789 44.473396 -111.050842 44.664562 -111.05265 44.995766 -110.428894 44.992348 -110.392006 44.998688 -109.994789 45.002853 -109.798653 44.99958 -108.624573 44.997643 -108.258568 45.00016 -107.893715 44.999813 -106.258644 44.996174 -106.020576 44.997227 -105.084465 44.999832 -105.04126 45.001091 -104.059349 44.997349 -104.058975 44.574368 -104.060547 44.181843 -104.059242 44.145844 -104.05899 43.852928 -104.057426 43.503738 -104.05867 43.47916 -104.05571 43.003094 -104.055725 42.614704 -104.053009 41.999851 -104.053108 41.698246</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom></topp:states></wfs:Insert></wfs:Transaction> | ||
<wfs:Transaction service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-transaction.xsd" xmlns:topp="http://www.openplans.org/topp"><wfs:Insert><topp:states><topp:STATE_NAME>Wyoming</topp:STATE_NAME><topp:STATE_FIPS>56</topp:STATE_FIPS><topp:SUB_REGION>Mtn</topp:SUB_REGION><topp:STATE_ABBR>WY</topp:STATE_ABBR><topp:LAND_KM>251500.801</topp:LAND_KM><topp:WATER_KM>1848.149</topp:WATER_KM><topp:PERSONS>453588</topp:PERSONS><topp:FAMILIES>119825</topp:FAMILIES><topp:HOUSHOLD>168839</topp:HOUSHOLD><topp:MALE>227007</topp:MALE><topp:FEMALE>226581</topp:FEMALE><topp:WORKERS>164561</topp:WORKERS><topp:DRVALONE>153679</topp:DRVALONE><topp:CARPOOL>28109</topp:CARPOOL><topp:PUBTRANS>2963</topp:PUBTRANS><topp:EMPLOYED>207868</topp:EMPLOYED><topp:UNEMPLOY>13112</topp:UNEMPLOY><topp:SERVICE>71419</topp:SERVICE><topp:MANUAL>29157</topp:MANUAL><topp:P_MALE>0.5</topp:P_MALE><topp:P_FEMALE>0.5</topp:P_FEMALE><topp:SAMP_POP>83202</topp:SAMP_POP><topp:the_geom><gml:MultiPolygon srsName="EPSG:4326"><gml:polygonMember><gml:Polygon srsName="EPSG:4326"><gml:exterior><gml:LinearRing><gml:posList>-104.053108 41.698246 -104.054993 41.564247 -104.053505 41.388107 -104.051201 41.003227 -104.933968 40.994305 -105.278259 40.996365 -106.202896 41.000111 -106.328545 41.001316 -106.864838 40.998489 -107.303436 41.000168 -107.918037 41.00341 -109.047638 40.998474 -110.001457 40.997646 -110.062477 40.99794 -111.050285 40.996635 -111.050911 41.25848 -111.050323 41.578648 -111.047951 41.996265 -111.046028 42.503323 -111.048447 43.019962 -111.04673 43.284813 -111.045998 43.515606 -111.049629 43.982632 -111.050789 44.473396 -111.050842 44.664562 -111.05265 44.995766 -110.428894 44.992348 -110.392006 44.998688 -109.994789 45.002853 -109.798653 44.99958 -108.624573 44.997643 -108.258568 45.00016 -107.893715 44.999813 -106.258644 44.996174 -106.020576 44.997227 -105.084465 44.999832 -105.04126 45.001091 -104.059349 44.997349 -104.058975 44.574368 -104.060547 44.181843 -104.059242 44.145844 -104.05899 43.852928 -104.057426 43.503738 -104.05867 43.47916 -104.05571 43.003094 -104.055725 42.614704 -104.053009 41.999851 -104.053108 41.698246</gml:posList></gml:LinearRing></gml:exterior></gml:Polygon></gml:polygonMember></gml:MultiPolygon></topp:the_geom></topp:states></wfs:Insert></wfs:Transaction> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<wfs:Transaction service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-transaction.xsd" xmlns:tiger="http://www.census.gov"><wfs:Insert><tiger:poi><tiger:NAME>museam</tiger:NAME><tiger:THUMBNAIL>pics/22037827-Ti.jpg</tiger:THUMBNAIL><tiger:MAINPAGE>pics/22037827-L.jpg</tiger:MAINPAGE><tiger:the_geom><gml:Point srsDimension="2" srsName="EPSG:4326"><gml:pos>-74.0104611 40.70758763</gml:pos></gml:Point></tiger:the_geom></tiger:poi></wfs:Insert></wfs:Transaction> | ||
<wfs:Transaction service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-transaction.xsd" xmlns:tiger="http://www.census.gov"><wfs:Insert><tiger:poi><tiger:NAME>museam</tiger:NAME><tiger:THUMBNAIL>pics/22037827-Ti.jpg</tiger:THUMBNAIL><tiger:MAINPAGE>pics/22037827-L.jpg</tiger:MAINPAGE><tiger:the_geom><gml:Point srsDimension="2" srsName="EPSG:4326"><gml:pos>-74.0104611 40.70758763</gml:pos></gml:Point></tiger:the_geom></tiger:poi></wfs:Insert></wfs:Transaction> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<wfs:Transaction service="WFS" version="1.1.0" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/WFS-transaction.xsd" xmlns:tiger="http://www.census.gov"><wfs:Update typeName="tiger:poi"><wfs:Property><wfs:Name>NAME</wfs:Name><wfs:Value>newName</wfs:Value></wfs:Property><ogc:Filter><ogc:FeatureId fid="poi.7"/></ogc:Filter></wfs:Update></wfs:Transaction> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const fidFilter = (fid) => | ||
`<ogc:Filter><ogc:FeatureId fid="${fid}"/></ogc:Filter>`; | ||
|
||
module.exports = { | ||
fidFilter | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
|
||
const {fidFilter} = require('../../Filter/base'); | ||
const {getTypeName} = require('../../WFS/base'); | ||
/** | ||
* Generate WFS delete features | ||
* @function | ||
* @param {string} content The content of the delete request, e.g. the filter to use | ||
* @param {object} describeFeatureType describeFeatureType object | ||
* @return {string} the XML for the update | ||
*/ | ||
const deleteFeatures = (content, typeName) => | ||
`<wfs:Delete typeName="${typeName}">${content}</wfs:Delete>`; | ||
const deleteById = (fid, typeName) => deleteFeatures(fidFilter(fid), typeName); | ||
const deleteFeature = (feature, describe) => deleteById(feature.features && feature.features.length === 1 ? feature.features[0].id : feature.id, getTypeName(describe)); | ||
module.exports = { | ||
deleteFeatures, | ||
deleteById, | ||
deleteFeature | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2017, GeoSolutions Sas. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
const {getTypeName} = require("../../WFS/base"); | ||
|
||
const property = (propName, value) => '<wfs:Property>' | ||
+ `<wfs:Name>${propName}</wfs:Name>` | ||
+ `<wfs:Value>${value}</wfs:Value>` | ||
+ '</wfs:Property>'; | ||
|
||
/** | ||
* Generate update XML. | ||
* @function | ||
* @param {string} content the properties to update and/or features to use (inXML) | ||
* @param {object} describeFeatureType describeFeatureType object | ||
* @return {string} the XML for the update | ||
*/ | ||
const update = (content, describeFeatureType) => `<wfs:Update typeName="${getTypeName(describeFeatureType)}">${Array.isArray(content) ? content.join("") : content}</wfs:Update>`; | ||
module.exports = { | ||
update, | ||
property | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters