طبقة العميل OGC WFS-T للنشرة.
عبر نبم:
npm i leaflet-wfst --save
عبر باور:
bower i leaflet-wfst --save
من جيثب:
npm i -S git://github.com/Flexberry/Leaflet-WFST.git#v1.1.1
حيث #v1.1.1 هو إصدار إصدار محدد.
options: {
crs : L . CRS . EPSG3857 ,
showExisting : true ,
geometryField : 'Shape' ,
url : '' ,
typeNS : '' ,
typeName : '' ,
opacity : 1 ,
style : {
color : 'black' ,
weight : 1
}
}
const wfstPointOptions = {
crs : L . CRS . EPSG4326 ,
showExisting : true ,
geometryField : 'geom' ,
url : `http://localhost:8080/geoserver/wfs` ,
typeNS : 'test' ,
typeName : 'test' ,
maxFeatures : 90 ,
opacity : 1 ,
style : function ( layer ) {
// you can use if statemt etc
return {
color : 'black' ,
weight : 1
}
} ,
} ;
const wfstPoint = new L . WFST ( wfstPointOptions , new L . Format . GeoJSON ( {
crs : L . CRS . EPSG4326 ,
pointToLayer ( geoJsonPoint , latlng ) {
const layer = new L . CircleMarker ( latlng , {
radius : 10 ,
} ) ;
return layer ;
} ,
} ) ) ;
wfstPoint . addTo ( map ) ;
اسم الخيار | تقصير | تعليق |
---|---|---|
crs | L.CRS.EPSG3857 | يجب أن يقوم نظام الإسناد المكاني للطبقة بتنفيذ ICRS، على سبيل المثال Proj4Leaflet |
showExisting | حقيقي | تحميل الميزات الموجودة على إنشاء طبقة |
GeometryField | 'شكل' | قد يتم حذف حقل تخزين الأشكال الهندسية، بالنسبة للخدمات غير المتعلقة بالمعاملات |
عنوان URL | - | عنوان URL لـ WFS، على سبيل المثال http://demo.opengeo.org/geoserver/osm/ows |
typeNS | - | اكتب مساحة الاسم |
اسم النوع | - | اكتب الاسم |
اكتبNSName | - | اكتب اسم مساحة الاسم |
مساحة الاسمUri | - | مساحة الاسم URI |
العتامة | 1 | عتامة الطبقة |
أسلوب | - | نمط ناقلات النشرة. وظيفة أو كائن |
فلتر | - | أي مرشح. انظر الفلتر |
الميزات القصوى | - | الحد من كمية الميزات التي تم إرجاعها |
var map = L . map ( 'map' ) . setView ( [ 0 , 0 ] , 2 ) ;
var boundaries = new L . WFS ( {
url : 'http://demo.opengeo.org/geoserver/ows' ,
typeNS : 'topp' ,
typeName : 'tasmania_state_boundaries' ,
crs : L . CRS . EPSG4326 ,
style : {
color : 'blue' ,
weight : 2
}
} ) . addTo ( map )
. on ( 'load' , function ( ) {
map . fitBounds ( boundaries ) ;
} )
يوسع فئات المنشورات باستخدام وظيفة toGml(crs):
يطلق نوعين من الأحداث:
تُكتب هندسة العلامات كـ posNode، أما هندسة جميع الطبقات الأخرى فتكتب كـ posList
تحقيق ترميز مرشح OGC v1.1.0
تقوم تطبيقات التصفية بإرجاع المحتوى الداخلي فقط لعنصر التصفية.
بعض الاعتبارات لجميع منشئي المرشح:
اسم | منشئ |
---|---|
بطاقة تعريف | |
معرف كائن Gml | L.Filter.GmlObjectId(معرف القيمة) |
مقارنات | |
PropertyIsEqualTo | L.Filter.EQ(propertyExpression firstArgument، literalExpression SecondArgument، bool matchCase) |
PropertyIsNotEqualTo | L.Filter.NotEQ(propertyExpression firstArgument, literalExpression SecondArgument, bool matchCase) |
PropertyIssLesThan | L.Filter.LT(propertyExpression firstArgument، literalExpression SecondArgument، bool matchCase) |
الخاصية أكبر من | L.Filter.GT(propertyExpression firstArgument, literalExpression SecondArgument, bool matchCase) |
PropertyIsLessThanOrEqualTo | L.Filter.LEQ(propertyExpression firstArgument، literalExpression SecondArgument، bool matchCase) |
الخاصية أكبر من أو يساوي | L.Filter.GEQ(propertyExpression firstArgument، literalExpression SecondArgument، bool matchCase) |
PropertyIsLike | L.Filter.Like(اسم خاصية السلسلة،سلسلة likeExpression،سمات الكائن) |
PropertyIsNull | L.Filter.IsNull(اسم خاصية السلسلة) |
PropertyIsBetween | L.Filter.IsBetween(propertyExpression firstArgument، literalExpression LowerBoundary، literalExpression UpperBoundary) |
مشغلي | |
يضيف | L.Filter.Add(تعبير، تعبير) |
الفرعية | L.Filter.Sub(تعبير، تعبير) |
مول | L.Filter.Mul (التعبير، التعبير) |
شعبة | L.Filter.Div(تعبير، تعبير) |
منطق | |
و | L.Filter.And(expression[, Expression]*) |
أو | L.Filter.Or(expression[, Expression]*) |
لا | L.Filter.Not(تعبير) |
المكانية | |
بي بوكس | L.Filter.BBox(اسم خاصية السلسلة، حدود latLngBounds، ICRS crs) |
يساوي | L.Filter.Equals(اسم خاصية السلسلة، هندسة الطبقة، ICRS crs) |
مفككة | L.Filter.Disjoint(اسم خاصية السلسلة، هندسة الطبقة، ICRS crs) |
اللمسات | L.Filter.Touches (اسم خاصية السلسلة، هندسة الطبقة، ICRS crs) |
داخل | L.Filter.Within (اسم خاصية السلسلة، هندسة الطبقة، ICRS crs) |
يتداخل | L.Filter.Overlaps (اسم خاصية السلسلة، هندسة الطبقة، ICRS crs) |
الصلبان | L.Filter.Crosses (اسم خاصية السلسلة، هندسة الطبقة، ICRS crs) |
يتقاطع | L.Filter.Intersects (اسم خاصية السلسلة، هندسة الطبقة، ICRS crs) |
يتضمن | L.Filter.Contains(اسم خاصية السلسلة، هندسة الطبقة، ICRS crs) |
المسافة المكانية العازلة | |
دداخل | L.Filter.DWithin (اسم خاصية السلسلة، هندسة الطبقة، ICRS crs، مسافة القيمة، وحدات السلسلة) |
وَرَاءَ | L.Filter.Beyond (اسم خاصية السلسلة، هندسة الطبقة، ICRS crs، مسافة القيمة، وحدات السلسلة) |
آخر | |
وظيفة | L.Filter.Function(اسم وظيفة السلسلة[، التعبير]*) |
اسم الخاصية | L.Filter.propertyName(اسم السلسلة) |
حرفي | L.Filter.literal(القيمة) |
PropertyName وLiteral عبارة عن وظائف وتقوم بإرجاع Gml مباشرةً.
يوجد في المعيار مرشحان - GmlObjectID وFeatureID، ولكن تم وضع علامة على الأحدث على أنه مهمل وبالتالي لم يتم تنفيذه.
مثال:
var filter = new L . Filter . GmlObjectID ( 1 ) ;
نتيجة XML:
< ogc : Filter xmlns : ogc = " http://www.opengis.net/ogc " >
< ogc : GmlObjectId xmlns : gml = " http://www.opengis.net/gml " gml : id = " 1 " />
</ ogc : Filter >
var filter = new L . Filter . EQ ( 'city' , 'Perm' ) ;
filter . toGml ( )
نتيجة XML:
< ogc : PropertyIsEqualTo >
< ogc : PropertyName >city</ ogc : PropertyName >
< ogc : Literal >Perm</ ogc : Literal >
</ ogc : PropertyIsEqualTo >
يقبل هذا المرشح كائن السمات الاختيارية:
attributes: {
wildCard : '*' ,
singleChar : '#' ,
escapeChar : '!' ,
matchCase : true
}
var filter = new L . Filter . Like ( 'city' , '*perm*' , { matchCase : false } ) ;
filter . toGml ( )
نتيجة XML:
< ogc : ogc:PropertyIsLike wildCard = " * " singleChar = " # " escapeChar = " ! " matchCase = " false " >
< ogc : PropertyName >city</ ogc : PropertyName >
< ogc : Literal >*perm*</ ogc : Literal >
</ ogc : ogc:PropertyIsLike >
مثال:
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 ) ;
filter . toGml ( )
نتيجة XML:
< ogc : Filter xmlns : ogc = " http://www.opengis.net/ogc " >
< ogc : BBOX >
< ogc : PropertyName >ogr_geometry</ ogc : PropertyName >
< gml : Envelope xmlns : gml = " http://www.opengis.net/gml " srsName = " EPSG:4326 " >
< gml : lowerCorner >-74.227 40.712</ gml : lowerCorner >
< gml : upperCorner >-74.125 40.774</ gml : upperCorner >
</ gml : Envelope >
</ ogc : BBOX >
</ ogc : Filter >
مثال:
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 ) ;
filter . toGml ( ) ;
نتيجة XML:
< ogc : Filter xmlns : ogc = " http://www.opengis.net/ogc " >
< ogc : Intersects >
< ogc : PropertyName >ogr_geometry</ ogc : PropertyName >
< gml : Polygon xmlns : gml = " http://www.opengis.net/gml " srsName = " EPSG:4326 " srsDimension = " 2 " >
< gml : exterior >
< gml : LinearRing srsDimension = " 2 " >
< gml : posList >-74.227 40.712 -74.125 40.774 -74.175 40.734 -74.227 40.712</ gml : posList >
</ gml : LinearRing >
</ gml : exterior >
</ gml : Polygon >
</ ogc : Intersects >
</ ogc : Filter >
تحرير البرنامج المساعد - Leaflet.Editable
L . WFST . include ( MultiEditableMixin ) ;
var wfst = new L . WFST ( {
url : 'http://myserver/geoserver/ows' ,
typeNS : 'myns' ,
typeName : 'POIPOINT' ,
style : {
color : 'blue' ,
weight : 2
}
} ) . addTo ( map ) . once ( 'load' , function ( ) {
map . fitBounds ( wfst ) ;
wfst . enableEdit ( ) ;
} ) ;
map . on ( 'editable:created' , function ( e ) {
wfst . addLayer ( e . layer ) ;
} ) ;
map . on ( 'editable:editing' , function ( e ) {
wfst . editLayer ( e . layer ) ;
} ) ;
لإجراء طلب POST "wfs:Transaction" لاستدعاء طريقة save()، مثال على Leaflet.EasyButton
L . easyButton ( 'fa-save' , function ( ) {
wfst . save ( ) ;
} , 'Save changes' ) ;
//simple layer
layer = new L . Marker ( [ 0 , 0 ] ) ;
layer . feature = {
id : 1 ,
properties : {
a : 'a' ,
b : 'b'
}
} ;
//get value by key 'a'
var a = layer . getProperty ( 'a' ) ;
//change values
layer . setProperties ( {
a : 'b' ,
b : 'a'
} ) ;
//add new property
layer . setProperties ( {
c : 'c'
} ) ;
//delete properties
layer . deleteProperties ( [ 'a' , 'b' , 'c' ] ) ;
عروض توضيحية لتنسيق قراءة GML
عرض توضيحي لتنسيق القراءة GeoJSON
مرشح تجريبي bbox
رخصة معهد ماساتشوستس للتكنولوجيا