Leaflet polygon (multi polygon) to CQL equivelent

المشرف العام

Administrator
طاقم الإدارة
I am using leaflet with geoserver. I want to set up a CQL filter to do an intersect but having an issue with getting the geometry from leaflet polygon to cql polygon.

For instance, the feature has the following.

gemoetry.coordinates is something like this when output as a string.

-90.89,46.67,-90.89,46.67,-90.89,46.67,-90.89,46.67,-90.89,46.67 CQL would need it in this format.

POLYGON((-90.89 46.67,-90.89 46.67,-90.89 46.67,-90.89 46.67,-90.89 46.67)) This would then be used to do something like this.

cql_filter=INTERSECTS(Geometry, POLYGON((-90.89 46.67,-90.89 46.67,-90.89 46.67,-90.89 46.67,-90.89 46.67)) However, it doesn't seem like leaflet has a toString or toCQL to convert a leaflet polygon to a CQL polygon. Now, one thing that comes to mind is writing a custom parser to go through and generate the CQL polygon needed to do the filter. This doesn't seem ideal to me and not sure how it would handle multipolygons. Is there an easy way to do this is leaflet?



أكثر...
 
أعلى