Re: [mapserver-users] Mapserver performance on apache - heavy load systems
Hi Steve, Thanks for your reply. However, most of my datasources are vector data. I've created a spatial index on the shapefiles, but with 4 000 000 features it still takes a long time to load everything. Should I increase ram, or cpu? or Both? the machines have 8 GB ram atm. I'm not sure what mapserver needs in heavy configurations. Besides the page on mapserver.org i dont find much on improving performance for load intensive systems. 2011/12/9 Lime, Steve D (DNR) steve.l...@state.mn.us Apache should be plenty quick. Start with using fastcgi and optimizing your data: e.g. create spatial indexes, use optimized raster formats and then optimizing your configuration (scale dependent layers w/things like reduced resolution layers where possible). -Steve ** ** *From:* mapserver-users-boun...@lists.osgeo.org [mailto: mapserver-users-boun...@lists.osgeo.org] *On Behalf Of *Peter Maes *Sent:* Friday, December 09, 2011 6:31 AM *To:* mapserver-users@lists.osgeo.org *Subject:* [mapserver-users] Mapserver performance on apache - heavy load systems ** ** Hi all, ** ** We are planning to launch a major mapserver production site where i'm required to launch many mapserver instances in some form of cluster. ** ** So I basically have some questions related to this: ** ** - Does anyone have good tips on performance for running mapserver on apache? - Any specific build parameters I should pay attention to? - Does it run as a native apache module, or is it required to work through cgi? In which case: will i get better performance by using fastcgi? (we are not using databases but shapefiles). - Should I consider lighttpd or nginx instead? ** ** - Any other tips related to clustering mapserver instances? :). ** ** Note that we are using live data, so we cannot cache them, except for a minute or so. ** ** Thanks for your time. ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] GAP problem on MapServer 6.0.1
I have been able to reproduce this problem with trunk. It seems to occur for gap lengths that are longer than the length of the line. In that case, the arrows are rendered for each line segment from the middle of the line to the end of the line. Slightly different behaviour for 6.0 and trunk. I have filed a ticket (http://trac.osgeo.org/mapserver/ticket/4120). Håvard On 11/10/2011 9:49 AM, Håvard Tveite wrote: Dear Jackey Cheung, I am not sure what exactly you are trying to achieve. Your arrows seem to point in the direction of the lines. The topmost arrow in figure 1 is placed at a strange position - is that the problem? Some comments: The result shown in image 2 is expected. The arrow symbols are in this case placed at the start points of the lines according to the centre point of the symbol's bounding rectangle (except 0,0 is always taken as the upper left corner of the bounding rectangle). When using a negative GAP, the direction of the symbol is the direction of the line at the (end)point. In version 6.2, ANCHORPOINT is introduced to make it possible to specify a different anchor point for the symbol (http://mapserver.org/trunk/mapfile/symbol.html). The centre point of the bounding box of your arrow_right symbol will be at (17.5,7) in the symbol's coordinate system, so the arrows will be placed somewhat shifted to the right (in the direction of the arrow). In 6.0, if you want the ends of the arrows to be aligned with the start of the lines (when using geomtransform start), you could use the following symbol: SYMBOL NAME arrow_right_shift TYPE VECTOR POINTS 30 6 52 6 50 0 60 7 # why 7.5? 50 14 52 8 30 8 30 6 END FILLED TRUE END In 6.2, you will be able to specify this using ANCHORPOINT 1 0.5 Håvard On 11/10/2011 06:35 AM, Jackey Cheung wrote: Hi all, We are trying to render line direction on 6.0.1. However, there are something weird with it. SYMBOL NAMEarrow_right TYPE VECTOR POINTS 5 6 27 6 25 0 35 7.5 25 14 27 8 5 8 5 6 END FILLED TRUE END LAYER NAME traffic_direction STATUSDEFAULT TYPE LINE MAXSCALEDENOM 5000 CONNECTIONTYPEPOSTGIS PROCESSINGCLOSE_CONNECTION=DEFER CONNECTIONhost=xxx dbname=*** user=xx password= DATA geom FROM view_render_traffic_direction USING UNIQUE oid USING SRID=4326 CLASS NAMETraffic Direction STYLE ANGLE AUTO SYMBOLarrow_right SIZE 6 COLOR 0 0 250 GAP -200 #GEOMTRANSFORM start END END END The layer above is rendered as 1.PNG. We've checked that there are only one line (ring) there, but arrows are rendered problematic. Then we've tried to change GEOMTRANSFORM to start or end, then rings seem OK, but all arrows at intersections got crossed, as 2.PNG. We've also tried to use OFFSET and GAP with positive and negative combinations, but none can solve the problem. Can anyone shed some light for us? Thanks in advance. -- Håvard Tveite Department of Mathematical Sciences and Technology, UMB Drøbakveien 31, POBox 5003, N-1432 Ås, NORWAY Phone: +47 64965483 Fax: +47 64965401 http://www.umb.no/imt/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Mapserver performance on apache - heavy load systems
Hi, Absolutely do not increase RAM, CPU or anything on that line. Instead, install all your data on a small slow laptop and make the system fast on that. - Analyze your situaltion and think what you want to give for your customers - Optimise the data for that purpose - Final step is to acquire as much computing power as needed Let's assume that you are going to publish your data through WMS. You said you have 4 000 000 features and it takes a long time to load them. I believe it is slow but fortunately you do not need to do it. The computer screen with 1152x864 resolution has only 955 328 pixels so your full screen view is trying to illustrate on average four features per pixel. If someone orders you to draw a map by hand with a pen and paper in that way you would say it is lunatic and that's correct. The key to draw faster is to draw less. This link shows a course example of speeding vector renderign by making Mapserver to draw less. http://www.paikkatietoikkuna.fi/web/en/map-window?zoomLevel=6coord=291620_6798042mapLayers=base_35+100+!default!,34+100+showMarker=falseforceCache=true There is a scale dependent group layer Lan Parcel Register 2010. The group consists or the original data layer and two reduced sets. Original data is shown at scale 1:10 or bigger (big scale - small number in scale denominator) and it comes from a shapefile with 1.2 million polygons. In the application the switch to original data happens between named zoom levels Town and Part of town. When zoomed out the data comes from teh first reduced data set (10% sample) and finally from the second reduced data set (1% sample). In this case I made the ten percent sample and one percent sample by selecting parcel IDs ending to one zero or two zeros, respectively. This way I can broadcast the selected parcels uniformly on the whole map area for giving a hint about the places having parcels. There is also a maximum limit for the number of parcels which are rendered (MAXFEATURES 1). I considered that ten thousand parcels per screen is always enough. For other data some other basis could be better for reducing the number of features to render. For example it is usually enough to render at maximum a few hundred biggest lakes an a map and that can be done by sorting data to descending order according to area and then applying MAXFEATURES. Another good way for making Mapserver to draw less and thus draw faster is to generalize the geometries to have less vertises. If you have a hundred pixels on a screen for showing a polygon then it will look just the same for the user with 20 or 20 000 vertises. The mapfile used in the linked example is attached. It is a little bit modified and does not necesarily work straight ahead but it should show the idea. Here is my ordered list about making vector rendering fast. Other people can suggest re-ordering or adding new items. I suppose there is something to think about when using classified layers and selecting classes with classitems and expressions. 1. Check the spatial indexes for shapefiles and in the database 2. Check other database indexes. In 98 percent of cases when user says that database is slow it just does not have a proper index for the query. 3. Draw less - less features, less vertices == 4. Draw simple - multiple styles and advanced labels have some cost 5. Re-project data beforehand instead of on-the-fly -Jukka Rahkonen- Peter Maes wrote: Hi Steve, Thanks for your reply. However, most of my datasources are vector data. I've created a spatial index on the shapefiles, but with 4 000 000 features it still takes a long time to load everything. Should I increase ram, or cpu? or Both? the machines have 8 GB ram atm. I'm not sure what mapserver needs in heavy configurations. Besides the page on mapserver.orghttp://mapserver.org i dont find much on improving performance for load intensive systems. 2011/12/9 Lime, Steve D (DNR) steve.l...@state.mn.usmailto:steve.l...@state.mn.us Apache should be plenty quick. Start with using fastcgi and optimizing your data: e.g. create spatial indexes, use optimized raster formats and then optimizing your configuration (scale dependent layers w/things like reduced resolution layers where possible). -Steve From: mapserver-users-boun...@lists.osgeo.orgmailto:mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.orgmailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Peter Maes Sent: Friday, December 09, 2011 6:31 AM To: mapserver-users@lists.osgeo.orgmailto:mapserver-users@lists.osgeo.org Subject: [mapserver-users] Mapserver performance on apache - heavy load systems Hi all, We are planning to launch a major mapserver production site where i'm required to launch many mapserver instances in some form of cluster. So I basically have some questions related to this: - Does anyone have good
RE: [mapserver-users] GEOMTRANSFORM LABELPNT example
Could someone post a summary of where this discussion is at? It's hard to tell given the length of the thread... Steve -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Brent Fraser Sent: Sunday, December 11, 2011 6:24 PM To: Stephen Woodbridge Cc: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] GEOMTRANSFORM LABELPNT example Steve, I agree the new features should be driven from specific use cases, but I like to expand designs to handle unforeseen uses (hopefully without adding complexity). So I prefer GEOMTRANSFORM (getCentroid(labelpoly)) instead of GEOMTRANSFORM LABELBBOXCENTROID My use cases for expanded GEOMTRANSFORM (from an earlier email with Steve L): --- The solution of using a STYLE with GEOMTRANSFORM got me thinking of using the technique to solve some of the labeling challenges: 2. Place polygon annotation on/inside boundary line (http://trac.osgeo.org/mapserver/ticket/1592 point 8.) - label the line geometry resulting from GEOMTRANSFORM (buffer([shape], -3)) of the original polygon 5. Place line anno above (or below) when using ANGLE FOLLOW - label the line geometry resulting from GEOMTRANSFORM (buffer([shape], 5)) of the original line - useful for labeling rivers above their geometry Currently the LABEL object uses the original geometry. Do you think it would be possible to [optionally?] use the GEOMTRANSFORMed geometry? Similarly, would it be possible to have the LABEL's convex hull (or a buffer the character boxes?) used as a clipping polygons of the layer's geometry to address: 8. Erase layer's geometry (but not other layers) under label - possible syntax: GEOMTRANSFORM ( clip( [labelpoly] ) ) - useful for labeling contours Best Regards, Brent Fraser On 12/11/2011 3:02 PM, Stephen Woodbridge wrote: It seems to me that we should develop specific use cases that we are trying to support. We have one that this feature was developed for, and that is as Steve L mention for labeling Highway Shields were the actual shield may be composed of multiple parts that need to be be super imposed relative to a label point, if I recall the details of that discussion without looking it up again. Ian, I think the point you are looking for is different. That would be the centroid of the label polygon. That point may or may not be coincidentally the same as the LABELPNT under some small set of configuration parameters but by no means guaranteed to be the same. I think that these points might be the same is you have a single line of text, ie: not wrapped, and POSITION CC and probable ANGLE 0. But I have not had time to test. -Steve W On 12/11/2011 4:18 PM, Ian Walberg wrote: So is it expected that labelpnt generates a point with its center at the middle of the bounding rectangle of the text? Thanks Ian -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Brent Fraser Sent: Sunday, December 11, 2011 1:02 PM To: thomas bonfort Cc: mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] GEOMTRANSFORM LABELPNT example Thomas, I tracked it down to the LABELCACHE setting. LABELCACHE ON gives the expected results LABELCACHE OFF gives my old blue-dot-on-the-left results. See attached PDFs. Best Regards, Brent Fraser On 12/11/2011 1:05 PM, thomas bonfort wrote: There might have been a bug in the initial implementation. trying it out with current trunk gives me the expected result, unless I'm missing something. On Sun, Dec 11, 2011 at 20:44, Brent Fraserbfra...@geoanalytic.com wrote: Thomas, See comments below. Best Regards, Brent Fraser On 12/11/2011 12:26 PM, thomas bonfort wrote: I think this is all expected behavior, although the documentation may be incorrect. LABELPNT draws a marker on the geographic position the label is attached to. This corresponds to the center of the label text only if the label is in position CC. I think that is what is intended but my original test case (using CC ) resulted in the LABELPNT rendered on the left side of the labelpoly, see http://lists.osgeo.org/pipermail/mapserver-dev/attachments/20110526/47c9bc8c/labelpnt-0001.png. I had expected it to be coincident with the yellow circle and green cross. To draw a label at the center of the label text, another geomtransform would have to be implemented, named e.g. LABELBBOXCENTROID. or maybe GEOMTRANSFORM (centroid([LABELPOLY])) regards, thomas On Sun, Dec 11, 2011 at 19:34, Brent Fraserbfra...@geoanalytic.com wrote: Hey Jeff, I've been looking into this too (not finished yet). I'm using v6.0.1 and can reproduce my original results (blue dot to the left) AND Ian's (grey dot coincident with white dot). Very strange. My shapefile dataset gets
RE: [mapserver-users] mimic geonames.org JSON server
1) Use mode=itemnquery and a regex search, something like qstring=/^value/. You’ll need to account for this in your validation string. 2) There is an outstanding bug regarding trimlast (see http://trac.osgeo.org/mapserver/ticket/4063) but I’m starting to think it’s a problem with single vs. double quotes in tag arguments. Try using double quotes… 3) There are a number of counter tags that should be available. See http://mapserver.org/mapfile/template.html and search for the [nr] tag and you’ll see the others documented below. Steve From: Mark Volz [mailto:volzm...@yahoo.com] Sent: Thursday, December 08, 2011 10:11 PM To: Lime, Steve D (DNR); mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] mimic geonames.org JSON server Steve, Thank you for your assistance. The code is starting to work. I just have a couple more questions. 1) How can I change the query on the html call to use regular expressions, or more particularly make the search a begins with search. Using qlayer=myLayerqitem=MyFieldqstring='myValue' obliviously returns only one result, however I would like to search for n items 2) In the JSON template, I have a comma separating each result. I thought that I could remove the final comma by adding [feature trimlast=',']. The final comment was not removed. how do I correctly use [feature trimlast=','] 3) for JSON templates is a variable for total results? If not is there another way to get a record count? Thanks From: Lime, Steve D (DNR) steve.l...@state.mn.us To: Mark Volz volzm...@yahoo.com; mapserver-users@lists.osgeo.org mapserver-users@lists.osgeo.org Sent: Thursday, December 8, 2011 10:26 AM Subject: RE: [mapserver-users] mimic geonames.org JSON server 1) Correct. Templates are just a means of presenting the results of a query operation. I’ve used templates to return json successfully. 2) Again, you need to issue a query. So to find a record in a layer you might do something like: http://localhost/cgi-bin/mapserv?map=mapfilemode=itemqueryqlayer=layerqitem=itemqstring=valueqformat=jsonformat This assumes that: for the layer in question you’ve setup a validation pattern for qstring and you’ve defined a output format called ‘jsonformat’. The one limitation I’ve found (and would like to fix) is that there’s no easy way to handle exceptions relative to the output format. For example, if you’re outputting json it would be nice to return errors (if possible, certain ones like mapfile not found can’t be dealt with other than in the default way) as json too. Let me know if you have questions. Steve From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Mark Volz Sent: Wednesday, December 07, 2011 10:06 PM To: mapserver-users@lists.osgeo.org; volzm...@yahoo.com Subject: [mapserver-users] mimic geonames.orghttp://geonames.org JSON server Hello, I recently came across an interesting openlayers application that uses geonames.org for a search functionality. I would like to be able to use my own gis data on the searches. I came across http://mapserver.org/trunk/output/template_output.html, which starts to describe how to make a template. I just have a couple questions. 1) My understanding is I can use any .map files that have a layer with appropriate fields. I just need to add another output format so that my .map file references a JSON template, and I can keep the standard image output formats. Is this correct? 2) How would the html request need to be formatted to search a specific value in a specific layer and return JSON? Any help and / or examples would be greatly appreciated. Thanks Mark ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] GEOMTRANSFORM LABELPNT example
Updates: - I have checked-in a documentation change for LABELPNT (using Thomas' clear wording for this): http://www.mapserver.org/mapfile/label.html?highlight=labelpnt - I have verified with trunk (6.1-dev) on Windows that Brent's report of using LABELCACHE OFF with GEOMTRANSFORM LABELPNT causes problems and is definitely a bug. I have created a tiny test case and attached it to a new ticket, please everyone involved in this thread add yourself to it and contribute (with this many people interested we should all be working on this ticket together-testing, commenting, etc): http://trac.osgeo.org/mapserver/ticket/4121 thanks. -jeff -- Jeff McKenna MapServer Consulting and Training Services http://www.gatewaygeomatics.com/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] small mapserver admin tool errors
Hi. Im writing a small admin tool for MapServer for own use in PHP with MapScript. I'm building a mapfile object with ms_newMapObj() and then throwing elements into database, forms, etc. I've got this problem that when a mapfile has errors (pure simple like 'IMAGETYPE pnhgg' instead 'IMAGETYPE png') the mapscript parser throws an error and the whole application stops. The thing is that I want the application on to at least tell the user, that his mapfile has errors and for example open a textarea where the user could edit his whole mapfile without throwing it to ms_newMapObj(). I tried many things but nothing seems to work. The thing is, it's msPostMapParseOutputFormatSetup() which actually crashes and which is used by ms_newMapObj(). I dont have access to msPostMapParseOutputFormatSetup(). Sample: A PHP Error was encountered Severity: Warning Message: ms_newMapObj(): [MapServer Error]: msPostMapParseOutputFormatSetup(): Unable to select IMAGETYPE `pnfg'. Filename: controllers/program.php Line Number: 35 Fatal error: Uncaught exception 'MapScriptException' with message 'Failed to open map file D:\ms4w\Apache\htdocs\p3\p3.map' in D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controllers\program.php:35 Stack trace: #0 D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controllers\program.php(35) : ms_newMapObj('D:\ms4w\Apache\...') #1 D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controllers\program.php(10) : Program-index() #2 [internal function]: Program-save_f_tmp() #3 D:\ms4w\Apache\htdocs\ci_doctrine\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #4 D:\ms4w\Apache\htdocs\ci_doctrine\index.php(115): require_once('D:\ms4w\Apache\...') #5 {main} thrown in D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controllers\program.php on line 35 Fatal error: Uncaught exception 'MapScriptException' with message 'Failed to open map file D:\ms4w\Apache\htdocs\map_file\map_file.map' in D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controllers\load_controler. php:35 Stack trace: #0 D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controllers\load_controler. php(35): ms_newMapObj('D:\ms4w\Apache\...') #1 D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controllers\load_controler. php(10): Program-index() #2 [internal function]: Program-svft() #3 D:\ms4w\Apache\htdocs\ci_doctrine\system\codeigniter\CodeIgniter.php(236): call_user_func_array(Array, Array) #4 D:\ms4w\Apache\htdocs\ci_doctrine\index.php(115): require_once('D:\ms4w\Apache\...') #5 {main} thrown in D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controllers\load_controler. php on line 35 Thanks for any help. -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/small-mapserver-admin-tool-errors-tp7087821p7087821.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
RE: [mapserver-users] GEOMTRANSFORM LABELPNT example
Here is an image and the map file we are using ms4w 3.0.3. We thought the larger grey circle should be drawn in the center of the label text. What have we done wrong? Thanks Ian LAYER DEBUG 5 NAME Test TYPE annotation STATUS DEFAULT FEATURE POINTS -122 33 END TEXT Some label text END CLASS LABEL FONT arialuni TYPE truetype ENCODING 'UTF-8' SIZE 14 COLOR 255 255 0 POSITION LR OFFSET 8 8 STYLE GEOMTRANSFORM LABELPOLY COLOR 200 50 50 END STYLE GEOMTRANSFORM LABELPNT SYMBOL 'circle' COLOR 100 100 100 SIZE 20 END STYLE COLOR 255 255 255 SYMBOL 'circle' SIZE 6 END END END END -Original Message- From: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Ian Walberg Sent: Saturday, December 10, 2011 3:53 PM To: Brent Fraser Cc: mapserver-users@lists.osgeo.org Subject: RE: [mapserver-users] GEOMTRANSFORM LABELPNT example Brent, We copied the example http://osgeo-org.1803224.n2.nabble.com/GEOMTRANSFORM-labelpnt-location-t http://osgeo-org.1803224.n2.nabble.com/GEOMTRANSFORM-labelpnt-location- t d6408065.html. However we see the GEOMTRANSFORM labelpnt drawing the circle on the point location not the center of the label text. Thanks Ian -Original Message- From: Brent Fraser [mailto:bfra...@geoanalytic.com] mailto:[mailto:bfra...@geoanalytic.com] Sent: Saturday, December 10, 2011 1:25 PM To: Ian Walberg Cc: mapserver-users@lists.osgeo.org mailto:mapserver-users@lists.osgeo.org Subject: RE: [mapserver-users] GEOMTRANSFORM LABELPNT example Ian, How are you specifying it in your mapfile? Brent Fraser Steve, We are still not seeing what we expect, we are testing with the ms4w 3.0.3 install, will this work? Thanks Ian -Original Message- From: mapserver-users-boun...@lists.osgeo.org mailto:mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] mailto:[mailto:mapserver-users-boun...@lists.osgeo.org] On Behalf Of Stephen Woodbridge Sent: Saturday, December 10, 2011 7:48 AM To: mapserver-users@lists.osgeo.org mailto:mapserver-users@lists.osgeo.org Subject: Re: [mapserver-users] GEOMTRANSFORM LABELPNT example On 12/10/2011 10:36 AM, Ian Walberg wrote: Does anyone have an example of the GEOMTRANSFORM LABELPNT? We have been trying this I were expecting the center to be located on the center of the label test border rectangle but we seem to be getting the center as the point location. Any ideas? Hi Ian, The label point is the that the label is placed about. The actual label position can change relative to the label point based on POSITION and other attributes of the label. I don't have the RFC in front of me but here is a good example to test with: http://osgeo-org.1803224.n2.nabble.com/GEOMTRANSFORM-labelpnt-location http://osgeo-org.1803224.n2.nabble.com/GEOMTRANSFORM-labelpnt-location -t d6408065.html Try varying the LABEL POSITION and see how it behaves. -Steve W ___ mapserver-users mailing list mapserver-users@lists.osgeo.org mailto:mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list mapserver-users@lists.osgeo.org mailto:mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users http://lists.osgeo.org/mailman/listinfo/mapserver-users ___ mapserver-users mailing list
AW: [mapserver-users] small mapserver admin tool errors
Use try+catch: http://www.php.net/manual/en/language.exceptions.php -Ursprüngliche Nachricht- Von: mapserver-users-boun...@lists.osgeo.org [mailto:mapserver-users-boun...@lists.osgeo.org] Im Auftrag von kaaos Gesendet: Montag, 12. Dezember 2011 22:30 An: mapserver-users@lists.osgeo.org Betreff: [mapserver-users] small mapserver admin tool errors Hi. Im writing a small admin tool for MapServer for own use in PHP with MapScript. I'm building a mapfile object with ms_newMapObj() and then throwing elements into database, forms, etc. I've got this problem that when a mapfile has errors (pure simple like 'IMAGETYPE pnhgg' instead 'IMAGETYPE png') the mapscript parser throws an error and the whole application stops. The thing is that I want the application on to at least tell the user, that his mapfile has errors and for example open a textarea where the user could edit his whole mapfile without throwing it to ms_newMapObj(). I tried many things but nothing seems to work. The thing is, it's msPostMapParseOutputFormatSetup() which actually crashes and which is used by ms_newMapObj(). I dont have access to msPostMapParseOutputFormatSetup(). Sample: A PHP Error was encountered Severity: Warning Message: ms_newMapObj(): [MapServer Error]: msPostMapParseOutputFormatSetup(): Unable to select IMAGETYPE `pnfg'. Filename: controllers/program.php Line Number: 35 Fatal error: Uncaught exception 'MapScriptException' with message 'Failed to open map file D:\ms4w\Apache\htdocs\p3\p3.map' in D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle rs\program.php:35 Stack trace: #0 D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle rs\program.php(35) : ms_newMapObj('D:\ms4w\Apache\...') #1 D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle rs\program.php(10) : Program-index() #2 [internal function]: Program-save_f_tmp() #3 D:\ms4w\Apache\htdocs\ci_doctrine\system\codeigniter\CodeIgnit er.php(236): call_user_func_array(Array, Array) #4 D:\ms4w\Apache\htdocs\ci_doctrine\index.php(115): require_once('D:\ms4w\Apache\...') #5 {main} thrown in D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle rs\program.php on line 35 Fatal error: Uncaught exception 'MapScriptException' with message 'Failed to open map file D:\ms4w\Apache\htdocs\map_file\map_file.map' in D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle rs\load_controler. php:35 Stack trace: #0 D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle rs\load_controler. php(35): ms_newMapObj('D:\ms4w\Apache\...') #1 D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle rs\load_controler. php(10): Program-index() #2 [internal function]: Program-svft() #3 D:\ms4w\Apache\htdocs\ci_doctrine\system\codeigniter\CodeIgnit er.php(236): call_user_func_array(Array, Array) #4 D:\ms4w\Apache\htdocs\ci_doctrine\index.php(115): require_once('D:\ms4w\Apache\...') #5 {main} thrown in D:\ms4w\Apache\htdocs\ci_doctrine\system\application\controlle rs\load_controler. php on line 35 Thanks for any help. -- View this message in context: http://osgeo-org.1803224.n2.nabble.com/small-mapserver-admin-t ool-errors-tp7087821p7087821.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 mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users