Opened 18 years ago
Last modified 14 years ago
#1644 reopened defect
generateSLD: problem translating regex to ogc:Literal
Reported by: | Owned by: | assefa | |
---|---|---|---|
Priority: | high | Milestone: | 6.0 release |
Component: | MapScript-PHP | Version: | 4.8 |
Severity: | normal | Keywords: | |
Cc: | jlam@… |
Description
The following CLASS exists on my LAYER: CLASS EXPRESSION /T.*/ METADATA END STYLE COLOR 255 0 0 MAXSIZE 500 MINSIZE 1 SYMBOL 0 END END This is translated to by generateSLD: <ogc:PropertyIsLike wildCard="*" singleChar="#" escape="!"><ogc:PropertyName>CYFER</ogc:PropertyName><ogc:Literal>T.*</ogc:Literal></ogc:PropertyIsLike> Which should be T* instead of T.*
Change History (14)
comment:2 by , 18 years ago
Cc: | added |
---|---|
Milestone: | → 4.10 release |
Setting target to 4.10. Adding Assefa to the cc.
comment:3 by , 18 years ago
Owner: | changed from | to
---|
Bart, working on this now ... The filter encoding property like is more limited compared to regular expressiosn that can be built in mapserver. I think we should define what is possible to convert properly and do those, and also identify potential problems. Example : - any time there is a .* in the expression it will be converted to * - any other character plus all the metacharcters . ^ $ * + ? { [ ] \ | ( ) would be outputed as is. (In case of mapserver, when we read the the ogc filter expression, we convert the wild card chracter to .*, and we convert the single chracter to . and the escpae character to \ all other are outputed as is) - the ogc tag would look like <ogc:PropertyIsLike wildCard="*" singleChar="." escape="\"> - type of potential problem : * if an expression is like /T*/ it will be converted to T* which is not correct. Please let me know what you think.
comment:4 by , 18 years ago
Hi Assefa, sounds good to me. The problem is that my knowledge of regex is very limited :-( Bart
comment:5 by , 18 years ago
Bart, I have updated the code according to comment #3. Please check if it solves your issues. Thanks.
comment:6 by , 18 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
Hi Assefa, I tested this one and it works fine now for my testcase. Thanks a lot! Settings STATUS to FIXED. Bart
comment:7 by , 18 years ago
Resolution: | fixed |
---|---|
Status: | closed → reopened |
Hi Assefa, I am using the latest mapogcsld.c. Can you confirm changes are only in there? I still have problems like, so reopening this bug: For the following expression: EXPRESSION /^Slappe.*/ the ogc:Literal becomes: <ogc:Literal>^Slappe*</ogc:Literal> Detailed info: LAYER CLASSITEM "MUTEERDER" CONNECTION "http://145.50.99.39:8082/basispakket/wfs/AGI_SDE?&ttt=1" CONNECTIONTYPE WMS DUMP TRUE METADATA "wms_srs" "EPSG:28992 EPSG:4326" "wms_onlineresource" "http://145.50.99.39:8082/basispakket/wfs/AGI_SDE?" "cham_x_build_expressions" "|@|0|MUTEERDER|LIKE||Slappe@|" "wms_latlonboundingbox" "5.2191 51.62802 7.07782 53.13325" "wfs_filter" "<ogc:BBOX><ogc:PropertyName>SHAPE</ogc:PropertyName><gml:Box srsName='EPSG:28992'><gml:coordinates>196560.628871,465300.002033 200644.899624,467750.564485</gml:coordinates></gml:Box></ogc:BBOX>" "layer_index" "7" "wms_queriable" "1" "wms_sld_url" "http://145.50.148.45/ms_tmp/sldxmlXuDnGw" "wms_name" "VGWATER" "wms_formatlist" "image/gif,image/jpeg,image/png,image/vnd.wap.wbmp,image/svg xml,image/x-bmp,image/tiff,application/vnd.google-earth.kml xml" "wms_format" "image/png" "selected" "0" "wms_sld_body" "" "wms_boundingbox" "EPSG:28992 143703.54688 405628.15625 268123.65625 571836.3125" "wms_server_version" "1.1.1" "wms_title" "Annotatielaag (expressie)" END NAME "ExpressionBuilderAnnotation" PROJECTION "init=epsg:28992" END SIZEUNITS PIXELS STATUS ON TEMPLATE "" TOLERANCEUNITS PIXELS TYPE POLYGON UNITS METERS CLASS NAME "Unknown" EXPRESSION /^Slappe.*/ METADATA END STYLE ANGLE 360 COLOR 255 0 0 SYMBOL 0 END END END I get: <StyledLayerDescriptor version="1.0.0" xmlns="http://www.opengis.net/sld" xmlns:gml="http://www.opengis.net/gml" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/sld http://schemas.opengeospatial.net/sld/1.0.0/StyledLayerDescriptor.xsd"> <NamedLayer> <Name>VGWATER</Name> <UserStyle> <FeatureTypeStyle> <Rule> <Name>Unknown</Name> <ogc:Filter><ogc:And><ogc:BBOX><ogc:PropertyName>SHAPE</ogc:PropertyName><gml:Box srsName='EPSG:28992'><gml:coordinates>196560.628871,465300.002033 200644.899624,467750.564485</gml:coordinates></gml:Box></ogc:BBOX><ogc:PropertyIsLike wildCard="*" singleChar="." escape="\"><ogc:PropertyName>MUTEERDER</ogc:PropertyName><ogc:Literal>^Slappe*</ogc:Literal></ogc:PropertyIsLike></ogc:And></ogc:Filter> <PolygonSymbolizer> <Fill> <CssParameter name="fill">#ff0000</CssParameter> </Fill> </PolygonSymbolizer> </Rule> </FeatureTypeStyle> </UserStyle> </NamedLayer> </StyledLayerDescriptor> Bart
comment:8 by , 18 years ago
Bart, what should the /^Slappe.*/ be translated to : Slappe* ? I am not sure if that is correct.
comment:9 by , 18 years ago
Hi Assefa, I would expect Slappe*. At least that what I am specifying in Chameleon's querybuilder interface. Chameleon's querybuilder uses Mapscript to translate ogc:Filter into REGEX, so apparently Mapscript translates this to /^Slappe.*/ Bart
comment:10 by , 18 years ago
Cc: | added |
---|
comment:11 by , 17 years ago
Cc: | added |
---|
Assefa, any news on the translation of regex /^Slappe.*/ to OGC filter? As I said I would expect Slappe* in PropertyIsLike, and not ^Slappe* like it is now. Tom, do you have any insight on what this translation should be?
comment:12 by , 17 years ago
I think the SLD would output Slappe*, the "" would be implicit in the Literal element. If you wanted it to be looser, then /.*Slappe.*/ would have to be set, and output *Slappe*.
comment:13 by , 17 years ago
Milestone: | 5.0 release → 5.2 release |
---|
comment:14 by , 14 years ago
Milestone: | 5.6 release → 6.0 release |
---|
Note:
See TracTickets
for help on using tickets.