Re: [mapserver-users] long expression statement doesn't work anymore
I sent a message with an attached test case to the mailinglist but now I'm waiting for approval because the attachment is too big. Rafael As I mentioned earlier, I'd love a test case! ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] parsing error with regular expression
hello what might be wrong with the code below ? it gives parsing error in java-mapscript EXPRESSION ('[yas_kod]' =~ /eosen/' and '[lkod]' =~ /.*Kumtasi.*/|/.*Camurtasi.*/') -- Open WebMail Project (http://openwebmail.org) -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] AGG Rendering problem
Hi all, This is my first post in a long time so be gentle...My problem is I have finally updated an old server to use MapServer 5.4.2 and want to use AGG rendering I have done this without a problem on another server earlier in the year but for some reason whenever I add the 'OUTPUTFORMAT' section and remove 'IMAGETYPE' I get a Connection Lost type error from the browser. Replace 'IMAGETYPE' and the connection is restored but the map is definitely not anti-aliased. Below is the relevant section from my mapfile and below that the output from a ./mapserv -v. Both outputs match the server that works. #IMAGETYPE JPEG OUTPUTFORMAT NAME "AGG_JPEG" DRIVER "AGG/JPEG" IMAGEMODE RGB END ./mapserv -vMapServer version 5.4.2 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_CLIENT SUPPORTS=FASTCGI SUPPORTS=GEOS INPUT=TIFF INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE Here's hoping you can help. Tony -- Tony Baylis Spatial Information Specialist Resource and Exploration Mapping Suite 8, 290 Boundary St Spring Hill QLD 4000 Ph3832 1600 Fax 3832 1603 Mob 0419 759 131 Email tony.bay...@resexmap.com.au www resexmap.com.au ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] AGG Rendering problem
Hi, Try adding MIMETYPE to outputformat. I guess that without it Mapserver is using default for jpeg requests. If you use, while testing, your own mimetype like MIMETYPE "image/jpeg2" and in request use &FORMAT=image/jpeg2 you should be able to compare what happens with image/jpeg and image/jpeg2. If jpeg2 works you know that Mapserver if using your own imageformat because otherwise image/jpeg2 would not be recognised. Then rename AGG MIMETYPE to image/jpeg and see if the output now seems to be generated by AGG. -Jukka Rahkonen- > -Alkuperäinen viesti- > Lähettäjä: mapserver-users-boun...@lists.osgeo.org > [mailto:mapserver-users-boun...@lists.osgeo.org] Puolesta Tony Baylis > Lähetetty: 26. lokakuuta 2009 15:15 > Vastaanottaja: mapserver-users@lists.osgeo.org > Aihe: [mapserver-users] AGG Rendering problem > > Hi all, > > This is my first post in a long time so be gentle...My > problem is I have finally updated an old server to use > MapServer 5.4.2 and want to use AGG rendering I have done > this without a problem on another server earlier in the year > but for some reason whenever I add the 'OUTPUTFORMAT' > section and remove 'IMAGETYPE' I get a Connection Lost type > error from the browser. Replace 'IMAGETYPE' and the > connection is restored but the map is definitely not anti-aliased. > > Below is the relevant section from my mapfile and below that > the output from a ./mapserv -v. Both outputs match the > server that works. > > #IMAGETYPE JPEG > OUTPUTFORMAT > NAME "AGG_JPEG" > DRIVER "AGG/JPEG" > IMAGEMODE RGB > END > > ./mapserv -vMapServer version 5.4.2 OUTPUT=GIF OUTPUT=PNG > OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG > SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV > SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_CLIENT > SUPPORTS=FASTCGI SUPPORTS=GEOS INPUT=TIFF > INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE > > Here's hoping you can help. > > Tony > > -- > Tony Baylis > Spatial Information Specialist > Resource and Exploration Mapping > Suite 8, 290 Boundary St > Spring Hill QLD 4000 > Ph3832 1600 > Fax 3832 1603 > Mob 0419 759 131 > Email tony.bay...@resexmap.com.au > www resexmap.com.au > > ___ > mapserver-users mailing list > mapserver-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapserver-users > ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] AGG Rendering problem
Also try setting the IMAGETYPE to the name of your output format. In your example you would want to set your image type as follows. IMAGETYPE AGG_JPEG By setting the imagetype to JPEG, I believe it would actually using the default output format as shown at http://mapserver.org/mapfile/outputformat.html . OUTPUTFORMAT NAME jpeg DRIVER "GD/JPEG" MIMETYPE "image/jpeg" IMAGEMODE RGB EXTENSION "jpg" END Paul On Oct 26, 2009, at 8:41 AM, Rahkonen Jukka wrote: > Hi, > > Try adding MIMETYPE to outputformat. I guess that without it > Mapserver is using default for jpeg requests. If you use, while > testing, your own mimetype like > MIMETYPE "image/jpeg2" and in request use &FORMAT=image/jpeg2 you > should be able to compare what happens with image/jpeg and image/ > jpeg2. If jpeg2 works you know that Mapserver if using your own > imageformat because otherwise image/jpeg2 would not be recognised. > Then rename AGG MIMETYPE to image/jpeg and see if the output now > seems to be generated by AGG. > > -Jukka Rahkonen- > >> -Alkuperäinen viesti- >> Lähettäjä: mapserver-users-boun...@lists.osgeo.org >> [mailto:mapserver-users-boun...@lists.osgeo.org] Puolesta Tony Baylis >> Lähetetty: 26. lokakuuta 2009 15:15 >> Vastaanottaja: mapserver-users@lists.osgeo.org >> Aihe: [mapserver-users] AGG Rendering problem >> >> Hi all, >> >> This is my first post in a long time so be gentle...My >> problem is I have finally updated an old server to use >> MapServer 5.4.2 and want to use AGG rendering I have done >> this without a problem on another server earlier in the year >> but for some reason whenever I add the 'OUTPUTFORMAT' >> section and remove 'IMAGETYPE' I get a Connection Lost type >> error from the browser. Replace 'IMAGETYPE' and the >> connection is restored but the map is definitely not anti-aliased. >> >> Below is the relevant section from my mapfile and below that >> the output from a ./mapserv -v. Both outputs match the >> server that works. >> >> #IMAGETYPE JPEG >> OUTPUTFORMAT >> NAME "AGG_JPEG" >> DRIVER "AGG/JPEG" >> IMAGEMODE RGB >> END >> >> ./mapserv -vMapServer version 5.4.2 OUTPUT=GIF OUTPUT=PNG >> OUTPUT=JPEG OUTPUT=WBMP OUTPUT=PDF OUTPUT=SWF OUTPUT=SVG >> SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=ICONV >> SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_CLIENT >> SUPPORTS=FASTCGI SUPPORTS=GEOS INPUT=TIFF >> INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE >> >> Here's hoping you can help. >> >> Tony >> >> -- >> Tony Baylis >> Spatial Information Specialist >> Resource and Exploration Mapping >> Suite 8, 290 Boundary St >> Spring Hill QLD 4000 >> Ph3832 1600 >> Fax 3832 1603 >> Mob 0419 759 131 >> Email tony.bay...@resexmap.com.au >> www resexmap.com.au >> >> ___ >> mapserver-users mailing list >> mapserver-users@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/mapserver-users >> > ___ > mapserver-users mailing list > mapserver-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] display CIRCULARSTRING / COMPOUNDCURVE
Hello list, I'm trying to display PostGIS geometries of type CIRCULARSTRING resp. COMPOUNDCURVE. Unfortunately I can only make MapServer draw those geometries using st_curvetoline. But I'd rather work with the original geometries not with approximated ones for they should be used for WFS also. Is MapServer not able to handle SQL/MM geometries directly? If so how do I persuade MapServer to do it? I'm using MapServer 5.4.0 and PostGIS 1.3.5. What about such geometries from Oracle Spatial? Does anyone has some experience with this? Greets, Jana. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] ShapeObj from WKT help please
POLYGON((x y,x y,x y,x y)) Can You help me, where can I display/export data in this format into SHP. I have recieved from my boss data in XLS with this geometry.. but I dont know how to work with it. Does anyone know? Anthony -- View this message in context: http://n2.nabble.com/ShapeObj-from-WKT-help-please-tp3796290p3892658.html Sent from the Mapserver - User mailing list archive at Nabble.com. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Serialize MapObj of phpmapscript
I have a script that dynamically generates images via phpmapscript (the data is dynamic and is based current users configuration stored in a database). The work flow is the following: Fetch layers, classes, styles configured by user from database and create mapserver objects based on this data. Now the question is I am doing this on every request is it possible to “serialize” somehow the mapobject and store in some cache backend and just alter the extents when new request arrives ? At the moment I can't do this because map object contains “handles” and “references”. I am already storing the styles, layer configuration in memcache, but I want to store the entire mapobj in it and clear the cache then user modifies something. Any solutions/ideas/tips ? P.S. Can't use tile cache because the data is dynamic. -- http://iap.md, The future is open ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] ShapeObj from WKT help please
http://mapserver.org/mapscript/php/index.html#shapeobj-class The second constructor will build this for you... ShapeObj ms_shapeObjFromWkt(string wkt) Or if you have a spreadsheet you could look at adding the whole thing to your mapfile, or converting it to shapefile (etc.) with ogr2ogr. http://mapserver.org/input/vector/VirtualSpatialData.html?highlight=ovf Josh touny wrote: > POLYGON((x y,x y,x y,x y)) > > Can You help me, where can I display/export data in this format into SHP. > I have recieved from my boss data in XLS with this geometry.. but I dont > know how to work with it. > Does anyone know? > > Anthony > > > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.423 / Virus Database: 270.14.32/2460 - Release Date: 10/26/09 > 08:10:00 > > ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] PHP Mapscript delivers map with larger extent than requested
I am using MapScript with PHP because I want to be able to request a map with a url, change the content-type and send saveImage directly to STDOUT. An example (relative) URL: map.php?lat=42.056542&lon=-88.035765&ext=300&pwide=500&ptall=500 Where "ext" is the width, in meters, on the ground (difference in longitude), "ptall" and "pwide" are the pixel dimensions of the desired map bitmap. If my server returns the map image I request, I can have the client calculate the coordinates of any pixel on the map image without having to bother the server. The server uses pwide/ptall and ext to determine difference in latitude, then the corners of the rectangle for MapObj::setextent(). Before I got your response, I was doing everything in lat/lon coordinates, but something in your note made me realize that I should use the native projection which is in meters for fewer calculations and an easier set of numbers to check the output. Here is the stripped-out code (functions merged, error-checking removed): // load a minimal map, add layer with specific map: $map = ms_newMapObj("/mapdata/minmap.map"); $map->setProjection("init=epsg:26916"); $lay = ms_newLayerObj($map); $lay->set("name", "tempRaster"); $lay->set("status", MS_ON); $lay->set("type", MS_LAYER_RASTER); $lay->set("data", "taxmap.tif"); $lay->setProjection("init=epsg:26916"); // projection objects for converting point $projlatlon = ms_newprojectionobj("proj=latlong"); $proj26916 = ms_newprojectionobj("init=epsg:26916"); $pt = ms_newPointObj(); $pt->setXY($lon,$lat); $pt->project($projlatlon, $proj26916); $halfTall = $ext * $pwide / $ptall / 2; $halfWide = $ext / 2; $map->setextent($pt->x-$halfWide, $pt->y-$halfTall, $pt->x+$halfWide, $pt->y+$halfTall); Given the example above, the extent values I use are: 414145.897891, 4656422.994605, 414445.897891, 4656722.994605, exactly 300 meters X and Y. Immediately after $map->setextent(), I look at the values of $map->extent and the values are: 414095.793507, 4656422.994605, 414496.002275, 4656722.994605 the differences are 400.21 X, 300 Y. 4/3 is familiar as screen ratio, but I don't see why that would apply here. Here is the .tfw file for the map (confirming square pixels): 0.20500199928690 0.0 0.0 -0.20500199928690 413698.77641943324 4656861.2550850855 Thanks for your response. I apologize for not including all this information in my first note, but too many times I have spent a lot of time writing a note like this only to get no responses. Chuck Jungmann My MapServer version info: MapServer version 5.0.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=FASTCGI SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR INPUT=GDAL INPUT=SHAPEFILE On Sun, 2009-10-25 at 01:06 -0400, Stephen Woodbridge wrote: > Chuck Jungmann wrote: > > I am a new user of MapServer, using version 5.0.3 from the Ubuntu > > repositories. I attempted to compile everything from source, had some > > trouble, then decided to use the repository shortcut at least until I > > understood how the application works. > > > > I am writing an application where the browser requests a map by setting > > the src attribute of an img object. Identifying locations on the > > resulting map requires that the application knows the extent. > > > > I calculate the extent of the map from various values, and use the same > > algorithms on the server so the browser and the server agree on the > > dimensions without having to negotiate. However, when I request the map > > from MapServer, the extent of the resulting map is always larger (both x > > and y dimensions) than what I requested, although still centered on the > > same point. > > > > Is this behavior normal (I don't want to beat my head against the wall > > searching for an irrelevant math error)? Is there some setting that > > might cause MapServer to more closely match my requested extent? Could > > this be an error that was fixed in a more recent version of MapServer? > > > > Any words of wisdom would be appreciated. > > Chuck, > > There are a number of conditions that may make mapserver checnge the > extents requested. > > 1) mapserver assumes square pixels, so if you ask for an extents that > has a different aspect ratio than that of you image size then mapserver > will make adjusts. > > 2) if you ask for extents and a scale, I think, mapserver will use the > extents to determine the center and then adjust the extents to the scale > > Are you using the CGI interface? what does you request look like? You > need to give us more concrete examples that we can try here to test out > and explain what is happening. What version of mapserver are you using? > > /path/to/mapserv -v > > Will report how it was build with options and version number. > > -Steve W. >
Re: [mapserver-users] PHP Mapscript delivers map with larger extent than requested
Where are you setting the map size? $map->setSize($pwide,$ptall); You may need to set the size of the map before you set the extents. Paul On Oct 26, 2009, at 11:44 AM, Chuck Jungmann wrote: > I am using MapScript with PHP because I want to be able to request a > map > with a url, change the content-type and send saveImage directly to > STDOUT. > > An example (relative) URL: > map.php?lat=42.056542&lon=-88.035765&ext=300&pwide=500&ptall=500 > > Where "ext" is the width, in meters, on the ground (difference in > longitude), "ptall" and "pwide" are the pixel dimensions of the > desired > map bitmap. If my server returns the map image I request, I can have > the client calculate the coordinates of any pixel on the map image > without having to bother the server. > > The server uses pwide/ptall and ext to determine difference in > latitude, > then the corners of the rectangle for MapObj::setextent(). > > Before I got your response, I was doing everything in lat/lon > coordinates, but something in your note made me realize that I should > use the native projection which is in meters for fewer calculations > and > an easier set of numbers to check the output. > > Here is the stripped-out code (functions merged, error-checking > removed): > > // load a minimal map, add layer with specific map: > $map = ms_newMapObj("/mapdata/minmap.map"); > $map->setProjection("init=epsg:26916"); > $lay = ms_newLayerObj($map); > $lay->set("name", "tempRaster"); > $lay->set("status", MS_ON); > $lay->set("type", MS_LAYER_RASTER); > $lay->set("data", "taxmap.tif"); > $lay->setProjection("init=epsg:26916"); > > // projection objects for converting point > $projlatlon = ms_newprojectionobj("proj=latlong"); > $proj26916 = ms_newprojectionobj("init=epsg:26916"); > > $pt = ms_newPointObj(); > $pt->setXY($lon,$lat); > $pt->project($projlatlon, $proj26916); > > $halfTall = $ext * $pwide / $ptall / 2; > $halfWide = $ext / 2; > > $map->setextent($pt->x-$halfWide, $pt->y-$halfTall, $pt->x+$halfWide, > $pt->y+$halfTall); > > Given the example above, the extent values I use are: > 414145.897891, 4656422.994605, 414445.897891, 4656722.994605, > exactly 300 meters X and Y. > > Immediately after $map->setextent(), I look at the values of > $map->extent and the values are: > 414095.793507, 4656422.994605, 414496.002275, 4656722.994605 > the differences are 400.21 X, 300 Y. 4/3 is familiar as screen ratio, > but I don't see why that would apply here. > > Here is the .tfw file for the map (confirming square pixels): > 0.20500199928690 > 0.0 > 0.0 > -0.20500199928690 > 413698.77641943324 > 4656861.2550850855 > > Thanks for your response. I apologize for not including all this > information in my first note, but too many times I have spent a lot of > time writing a note like this only to get no responses. > > Chuck Jungmann > > > > > > My MapServer version info: > MapServer version 5.0.3 OUTPUT=GIF OUTPUT=PNG OUTPUT=JPEG OUTPUT=WBMP > OUTPUT=SVG SUPPORTS=PROJ SUPPORTS=AGG SUPPORTS=FREETYPE > SUPPORTS=WMS_SERVER SUPPORTS=WMS_CLIENT SUPPORTS=WFS_SERVER > SUPPORTS=WFS_CLIENT SUPPORTS=WCS_SERVER SUPPORTS=FASTCGI > SUPPORTS=THREADS SUPPORTS=GEOS INPUT=EPPL7 INPUT=POSTGIS INPUT=OGR > INPUT=GDAL INPUT=SHAPEFILE > > > > On Sun, 2009-10-25 at 01:06 -0400, Stephen Woodbridge wrote: >> Chuck Jungmann wrote: >>> I am a new user of MapServer, using version 5.0.3 from the Ubuntu >>> repositories. I attempted to compile everything from source, had >>> some >>> trouble, then decided to use the repository shortcut at least >>> until I >>> understood how the application works. >>> >>> I am writing an application where the browser requests a map by >>> setting >>> the src attribute of an img object. Identifying locations on the >>> resulting map requires that the application knows the extent. >>> >>> I calculate the extent of the map from various values, and use the >>> same >>> algorithms on the server so the browser and the server agree on the >>> dimensions without having to negotiate. However, when I request >>> the map >>> from MapServer, the extent of the resulting map is always larger >>> (both x >>> and y dimensions) than what I requested, although still centered >>> on the >>> same point. >>> >>> Is this behavior normal (I don't want to beat my head against the >>> wall >>> searching for an irrelevant math error)? Is there some setting that >>> might cause MapServer to more closely match my requested extent? >>> Could >>> this be an error that was fixed in a more recent version of >>> MapServer? >>> >>> Any words of wisdom would be appreciated. >> >> Chuck, >> >> There are a number of conditions that may make mapserver checnge the >> extents requested. >> >> 1) mapserver assumes square pixels, so if you ask for an extents that >> has a different aspect ratio than that of you image size then >> mapserver >> will make adjusts. >> >> 2) if you ask for extents and a scale, I think, mapserver will use >> the >> ext
Re: [mapserver-users] Serialize MapObj of phpmapscript
You can read a mapfile in PHP suck it's contents into a string (outside mapscript) and store that in your cache once. Then you can pull that string from the cache when needed an instantiate a mapObj from it. About the best you can do at the moment I think. Steve >>> On 10/26/2009 at 11:03 AM, in message <2a37f67a0910260903g29482f00j136f80cd3f8d6...@mail.gmail.com>, Pavel Iacovlev wrote: > I have a script that dynamically generates images via phpmapscript > (the data is dynamic and is based current users configuration stored > in a database). > The work flow is the following: Fetch layers, classes, styles > configured by user from database and create mapserver objects based on > this data. > > Now the question is I am doing this on every request is it possible to > “serialize” somehow the mapobject and store in some cache backend and > just alter the extents when new request arrives ? At the moment I > can't do this because map object contains “handles” and “references”. > I am already storing the styles, layer configuration in memcache, but > I want to store the entire mapobj in it and clear the cache then user > modifies something. > > Any solutions/ideas/tips ? > > P.S. Can't use tile cache because the data is dynamic. > > -- > http://iap.md, The future is open > ___ > mapserver-users mailing list > mapserver-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Re: [mapserver-dev] WMS Performance Shootout presentation/results
Jeff, many, many thanks to you and all the folks working from both projects on the benchmarking exercise. Sounds like the presentation was very successful and MapServer made a very respectable showing. Congrats! Steve >>> On 10/23/2009 at 6:21 PM, in message >>> <4ae23a6a.4080...@gatewaygeomatics.com>, Jeff McKenna wrote: > For those that did not make it to Sydney, here is the WMS Performance > Shootout presentation with results (GeoServer vs MapServer): > > http://www.slideshare.net/gatewaygeomatics.com/wms-performance-shootout > > Power users who manage MapServer sites with high loads/map draws should > take note of the results of MapServer CGI vs MapServer FastCGI, even in > the case of Shapefiles and Rasters (yes, quite surprising). > > -jeff > ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] parsing error with regular expression
Invalid regex. Try: ('[yas_kod]' =~ /eosen/ and '[lkod]' =~ /.*Kumtasi|Camurtasi.*/) Steve >>> On 10/26/2009 at 8:06 AM, in message <20091026130337.m60...@deprem.gov.tr>, "Ahmet Temiz" wrote: > hello > > what might be wrong with the code below ? > it gives parsing error in java-mapscript > > EXPRESSION > ('[yas_kod]' =~ /eosen/' and '[lkod]' =~ /.*Kumtasi.*/|/.*Camurtasi.*/') > > > -- > Open WebMail Project (http://openwebmail.org) > ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] quotes in EXPRESSION, ATTRIBUTE type
Answers inline... >>> On 10/25/2009 at 1:49 PM, in message <1256496568727-3888456.p...@n2.nabble.com>, Ted Spradley wrote: > Hi all, hope your weekend is good! > > Getting all of the Test Suite examples to function with my ver 5.4.1 of > MapServer. > > 1. Expressions can no longer be passed in the url correct? If attempted, > they are just ignored > with 5.0+? This, unfortunately varies a bit by version, but was standardized in 5.4+. You can pass an expression but it *must* be validated. See: http://mapserver.org/development/rfc/ms-rfc-44.html You can set validation blocks at the CLASS, LAYER or WEB levels and the most specific context trumps the others. The code checks, class, then layer and finally the web. So if you want to allow setting expressions on all layers without any checking you'd add this to the WEB object: VALIDATION EXPRESSION '.' END We're still working on assembling the definitive list of which params can be changed via URL and of those, which need validation. In general anything that is free form (e.g. not a number or a color) will require it. > 2. When using expressions in classes, we treat the expressions as 'regular' > SQL statements? > i.e. If the ATTRIBUTE type is a string, we quote it, and if the type is > numeric we don't? Correct, for the most part. If you're storing ints in a string column you could still not quote things and it should work. If you have blank data though you could run into problems. > The map excerpt below is from my modification of > /tests46/expressions/test.map. The > image renders as expected when I finally snapped to removing quote marks > from > EXPRESSION ("[AREA]" > '%area%' ) (which did evaluate without error, but > was evidently1 making string comparison of the values) Correct. String testing like this is valid but isn't of that much practical use although dates (e.g. 1990-10-20) can be tested like this. > . > LAYER > NAME counties_hilite > DATA county > STATUS ON > TYPE POLYGON > CLASS > EXPRESSION ('%cty_fips%' = "[CTY_FIPS]") > COLOR 255 255 0 > END > CLASS > EXPRESSION ([AREA] > %area% ) > COLOR 212 212 212 > END > END > . > > 3. When or when not to declare a CLASSITEM? Only when inserting more than > one CLASS for > for the same attribute? And its purpose is to basically make a > shorthand for the SQL statement > in our EXPRESSION? e.g., > CLASSITEM 'NAME' > CLASS > EXPRESSION ('some name') # in lieu of EXPRESSION ("[NAME]" = 'some > name') > COLOR 255 255 255 > END > CLASS > EXPRESSION ('some other name') > COLOR 0 0 0 > END A class item is necessary when using expressions that don't reference columns somehow. Basically this means you need a class item with straight string or regex expressions but not for logical one. It doesn't hurt to set the value. So, in summary: EXPRESSION 'foo' or EXPRESSION /bar/ need CLASSITEM. While: EXPRESSION ('[item1]' eq 'foo' || '[item2]' =~ /bar/) does not... Logical expressions are slower to evaluate so avoid 'em if you can. > Thanks in advance! Enjoying this more every day! > Ted S. Steve ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users