Re: [mapserver-users] php mapscript objects in session?
according to my little knowledge, php cannot store an instance of an object in a session, only primitives variables like strings, integers, floats and arrays (asp.net instead can). for your app you must save the context (mapfile path, the extent, the layers status etc.), and re-instance the map object at each postback. hth pg -- Pietro Giannini Bytewise srl - Area GIS 41°50'38.58N 12°29'13.39E On Ven, Novembre 21, 2008 00:33, Christopher Condit wrote: Hi- I'm using ms4w 2.2.7 and I've run into a problem. Ideally I'd like to create the MapScript map object and store it in the session: $_SESSION['map'] = ms_newMapObj($getMapPath); This works fine for the that page, for the first call, but when I attempt to reference it later I get a PHP error: Fatal error: Object has an invalid _handle_ property Am I missing something here? Thanks, -Chris ___ 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] php mapscript objects in session?
And even if it was possible it is NOT recommended to reuse mapscript objects across requests, see my previous post on the Mapserver Thread Safety thread earlier this week. Umberto On Fri, Nov 21, 2008 at 10:13 AM, Pietro Giannini [EMAIL PROTECTED] wrote: according to my little knowledge, php cannot store an instance of an object in a session, only primitives variables like strings, integers, floats and arrays (asp.net instead can). for your app you must save the context (mapfile path, the extent, the layers status etc.), and re-instance the map object at each postback. hth pg -- Pietro Giannini Bytewise srl - Area GIS 41°50'38.58N 12°29'13.39E On Ven, Novembre 21, 2008 00:33, Christopher Condit wrote: Hi- I'm using ms4w 2.2.7 and I've run into a problem. Ideally I'd like to create the MapScript map object and store it in the session: $_SESSION['map'] = ms_newMapObj($getMapPath); This works fine for the that page, for the first call, but when I attempt to reference it later I get a PHP error: Fatal error: Object has an invalid _handle_ property Am I missing something here? Thanks, -Chris ___ 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
Re: [mapserver-users] php mapscript objects in session?
On Fri, Nov 21, 2008 at 11:55 AM, Pietro Giannini [EMAIL PROTECTED] wrote: Ciao Umberto, excuse me, but your statement has put me in a state of anxiety :) Currently I'm involved in an ASP.NET C# mapscript developement, and I use extensively the method of saving mapscript object in session. Naturally I tested the envirenmnet with a certain number of concurrent users, and I don't get any strange issue, like accessing to an object of another session. so, do you share objects (like a mapobj) between sessions (ie: different requests use the same mapObj instance to perform map drawing) without locking at application (c# in your case) level? If the answer is yes you've just been lucky so far as this approach will surely lead to errors. Why do you say this is NOT recommended? I'm sorry, I can't provide technical arguments right now, but in my experience (+3years with Java mapscript) this solution proved to be the most stable. YMMV. Ciao, Umberto ciao ...pg -- Pietro Giannini Bytewise srl - Area GIS 41°50'38.58N 12°29'13.39E On Ven, Novembre 21, 2008 10:20, Umberto Nicoletti wrote: And even if it was possible it is NOT recommended to reuse mapscript objects across requests, see my previous post on the Mapserver Thread Safety thread earlier this week. Umberto On Fri, Nov 21, 2008 at 10:13 AM, Pietro Giannini [EMAIL PROTECTED] wrote: according to my little knowledge, php cannot store an instance of an object in a session, only primitives variables like strings, integers, floats and arrays (asp.net instead can). for your app you must save the context (mapfile path, the extent, the layers status etc.), and re-instance the map object at each postback. hth pg -- Pietro Giannini Bytewise srl - Area GIS 41°50'38.58N 12°29'13.39E On Ven, Novembre 21, 2008 00:33, Christopher Condit wrote: Hi- I'm using ms4w 2.2.7 and I've run into a problem. Ideally I'd like to create the MapScript map object and store it in the session: $_SESSION['map'] = ms_newMapObj($getMapPath); This works fine for the that page, for the first call, but when I attempt to reference it later I get a PHP error: Fatal error: Object has an invalid _handle_ property Am I missing something here? Thanks, -Chris ___ 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 mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[MAPSERVER-USERS] CLASSITEM and EXPRESSION issue in trunk?
Hi! I've compiled 5.3-dev from trunk yesterday and got some trouble with some mapfiles that works well on 5.2. The problem is that the EXPRESSION parameter in the CALSS object does not work with direct string comparison. Her are some examples: Does NOT work: (This is the original layer definition from the 5.2 mapfile) LAYER ... CLASSITEM maxhoyde ... CLASS NAME test EXPRESSION 600 ... END END Using RegEx instead WORKS: LAYER ... CLASSITEM maxhoyde ... CLASS NAME test EXPRESSION /600/ ... END END Using logical expression WORKS: LAYER ... #CLASSITEM maxhoyde ... CLASS NAME test EXPRESSION ([makshoyde] == 600) ... END END The data is stored in PostgreSQL (PostGIS), and the actual field type is character(5). Anyone have a clue about what is causing this strange behavior. Regards, Pål Kristensen -- View this message in context: http://www.nabble.com/CLASSITEM-and-EXPRESSION-issue-in-trunk--tp20622309p20622309.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] CLASSITEM and EXPRESSION issue in trunk?
Hi Steve, thanks for the quick response! I know about the PostGIS refactoring activity, and that is one of the things that we wanted to test. For the overall speed it looks great, but it can be some troublesome if old expressions don't work. One of our mapfiles is almost 12000 lines (with quite complex expressions), and I do not intend to change all the expressions :-). Do you know if anyone has the opportunity to look at this issue? Regards, Pål Kristensen Steve Lime wrote: The PostGIS support underwent major changes recently so I'd suspect this is specific to that work. Perhaps there are character padding affecting things? Steve Pål Kristensen [EMAIL PROTECTED] 11/21/08 8:36 AM Hi! I've compiled 5.3-dev from trunk yesterday and got some trouble with some mapfiles that works well on 5.2. The problem is that the EXPRESSION parameter in the CALSS object does not work with direct string comparison. Her are some examples: Does NOT work: (This is the original layer definition from the 5.2 mapfile) LAYER ... CLASSITEM maxhoyde ... CLASS NAME test EXPRESSION 600 ... END END Using RegEx instead WORKS: LAYER ... CLASSITEM maxhoyde ... CLASS NAME test EXPRESSION /600/ ... END END Using logical expression WORKS: LAYER ... #CLASSITEM maxhoyde ... CLASS NAME test EXPRESSION ([makshoyde] == 600) ... END END The data is stored in PostgreSQL (PostGIS), and the actual field type is character(5). Anyone have a clue about what is causing this strange behavior. Regards, Pål Kristensen -- View this message in context: http://www.nabble.com/CLASSITEM-and-EXPRESSION-issue-in-trunk--tp20622309p20622309.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 -- View this message in context: http://www.nabble.com/Re%3A-CLASSITEM-and-EXPRESSION-issue-in-trunk--tp20622400p20622659.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] CLASSITEM and EXPRESSION issue in trunk?
The PostGIS support underwent major changes recently so I'd suspect this is specific to that work. Perhaps there are character padding affecting things? Steve Pål Kristensen [EMAIL PROTECTED] 11/21/08 8:36 AM Hi! I've compiled 5.3-dev from trunk yesterday and got some trouble with some mapfiles that works well on 5.2. The problem is that the EXPRESSION parameter in the CALSS object does not work with direct string comparison. Her are some examples: Does NOT work: (This is the original layer definition from the 5.2 mapfile) LAYER ... CLASSITEM maxhoyde ... CLASS NAME test EXPRESSION 600 ... END END Using RegEx instead WORKS: LAYER ... CLASSITEM maxhoyde ... CLASS NAME test EXPRESSION /600/ ... END END Using logical expression WORKS: LAYER ... #CLASSITEM maxhoyde ... CLASS NAME test EXPRESSION ([makshoyde] == 600) ... END END The data is stored in PostgreSQL (PostGIS), and the actual field type is character(5). Anyone have a clue about what is causing this strange behavior. Regards, Pål Kristensen -- View this message in context: http://www.nabble.com/CLASSITEM-and-EXPRESSION-issue-in-trunk--tp20622309p20622309.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
Re: [mapserver-users] UTF-8 + SDE + GetfeatureInfo
On Nov 20, 2008, at 2:46 PM, Chris Whitteker wrote: Hey everyone, We're having a bit of a problem performing getfeatureinfo queries with mapserver. The french characters are coming out of the database as ISO-8859-1 instead of UTF-8. The database and servers are configured as UTF 8, the map files and the query templates too. Actually text/plain also has problems so it's not the templates. We're trying to encode everything as UTF 8 so me specificying ISO-8859-1 in the meta tag of the html query template doesn't work. GetFeatureInfo results: Layer 'SoilOrder' Feature 10894: OBJECTID = '10894' SLC_SOIL_ORDER_V31_22_ID = '81600931' SOIL_ORDER_NAME_EN = 'Chernozemic' SOIL_ORDER_NAME_FR = 'Chernoz�mique' - error is here in my browser. SOIL_ORDER_PCNT = '84' SHAPE = 'shape' Any idea if there are outstanding problems here with SDE and mapserver not playing nice with this? We're beating our heads against the wall thinking about what config we could have missed. Oh - labels with french are fine, and so are legends; it's only the getfeatureinfo queries that have troubles. The problem is very likely SDE. Can you get things to work with a simple shapefile? Do you know what the SOIL_ORDER_NAME_FR column type is defined as?___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] Re: php mapscript objects in session?
Hi- I'm using ms4w 2.2.7 and I've run into a problem. Ideally I'd like to create the MapScript map object and store it in the session: $_SESSION['map'] = ms_newMapObj($getMapPath); This works fine for the that page, for the first call, but when I attempt to reference it later I get a PHP error: Fatal error: Object has an invalid _handle_ property Am I missing something here? Thanks, -Chris Chris, When you attempt to start a session, you need to load the class definition first. For example ?php require('myclass.php'); session_start(); ? Jim -- James (Jim) B. White tel: (919)-380-9615 homepage: http://jimserver.net/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
[mapserver-users] filtering features of layer by quarries in attribute table
Hi, I would like to have attributed of a layer, displayed according their area. For example, I want to display a simple polygon layer, which have in the attribute table the field AREA which is the field in meter sq. I would like to display the layer in 3 different color schemes, like - color a for AREA 1000, color b for AREA 1000 AREA 5000, and color c for AREA 5000 . From map server tutorial I saw I can refer to string attribute, for example: I used the files from: http://biometry.gis.umn.edu/cgi-bin/mapserv.exe?map=/ms4w/apps/tutorial/htdocs/example2.maplayer=stateszoom=0mode=browseroot=/tutorialprogram=/cgi-bin/mapserv.exemap_web=template+example2-4.html Here is what I am talking about... CLASSITEM 'FEATURE' CLASS NAME 'Lakes' EXPRESSION /(^B|^C|^L|^R)./ STYLE COLOR 72 64 254 END END # CLASS CLASS NAME 'Rivers' EXPRESSION 'Stream' STYLE COLOR 136 128 255 END END # CLASS CLASS NAME 'Wetlands' EXPRESSION 'Swamp or Marsh' STYLE COLOR 195 252 255 OUTLINECOLOR 195 252 255 SYMBOL 'circle' SIZE 0 END END # CLASS END # LAYER But all my attempts to classify water bodies according to their area did not succeed. Can anyone help me? Thanks, Oz --- when one person suffers from a delusion it is called insanity. When many people suffer from a delusion it is called religion. Robert Pirsig, Zen and the Art of Motorcycle Maintenance ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
RE: [mapserver-users] Re: php mapscript objects in session?
-Original Message- From: [EMAIL PROTECTED] [mailto:mapserver-users- [EMAIL PROTECTED] On Behalf Of jim white Sent: Friday, November 21, 2008 9:19 AM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] Re: php mapscript objects in session? Hi- I'm using ms4w 2.2.7 and I've run into a problem. Ideally I'd like to create the MapScript map object and store it in the session: $_SESSION['map'] = ms_newMapObj($getMapPath); This works fine for the that page, for the first call, but when I attempt to reference it later I get a PHP error: Fatal error: Object has an invalid _handle_ property Am I missing something here? Thanks, -Chris Chris, When you attempt to start a session, you need to load the class definition first. For example ?php require('myclass.php'); session_start(); ? Hi Jim- Thanks for responding... Actually, I can store non MapScript objects in the $_SESSION just fine, but when I attempt to either: 1) add the MapScript object as a private member of my class 2) simply save the MapScript object to the $_SESSION and then reuse, I get the error. Have you managed to store MapScript objects in sessions? -Chris ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Re: php mapscript objects in session?
Christopher Condit wrote: -Original Message- From: [EMAIL PROTECTED] [mailto:mapserver-users- [EMAIL PROTECTED] On Behalf Of jim white Sent: Friday, November 21, 2008 9:19 AM To: mapserver-users@lists.osgeo.org Subject: [mapserver-users] Re: php mapscript objects in session? Hi- I'm using ms4w 2.2.7 and I've run into a problem. Ideally I'd like to create the MapScript map object and store it in the session: $_SESSION['map'] = ms_newMapObj($getMapPath); This works fine for the that page, for the first call, but when I attempt to reference it later I get a PHP error: Fatal error: Object has an invalid _handle_ property Am I missing something here? Thanks, -Chris Chris, When you attempt to start a session, you need to load the class definition first. For example ?php require('myclass.php'); session_start(); ? Hi Jim- Thanks for responding... Actually, I can store non MapScript objects in the $_SESSION just fine, but when I attempt to either: 1) add the MapScript object as a private member of my class 2) simply save the MapScript object to the $_SESSION and then reuse, I get the error. Have you managed to store MapScript objects in sessions? -Chris Chris, No I haven't saved a Mapscript object. Perhaps this is more a response to another post that said you could only access session variables, and not classes, from another page. However, you might try replacing require('myclass.php'); with if(!extension_loaded('MapScript')){ dl(php_mapscript.so); } There must be a way to persist a mapscript object, but I don't know enough of OO design to tell you the answer. Jim -- James (Jim) B. White tel: (919)-380-9615 homepage: http://jimserver.net/ ___ mapserver-users mailing list mapserver-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapserver-users
Re: [mapserver-users] Create a file GML from a layer of typeannotation.
2008/11/21 Pietro Giannini [EMAIL PROTECTED]: If I understood, you want to use mapserver as a label-generator, because the algorithm used satisfy you, but IMHO there is no method to extract the labels generated from mapserver, also using mapscript. Yes Pietro, exactly. In your place, I would use directly a desktop GIS, whatever you want, to generate labels directly from layer source. Try UDig (udig.refractions.net) as free GIS, it has a non-collision algorithm for objects labels. I tried UDig. I like the labels. However, I have not found a way to export the labels out of uDig (generalized to a certain scale). And what I wish, finally, is to use the results of labeling in GMT. another way? a ready-to-use library for cartographic label placement under free software license - http://geosysin.iict.ch/trac/wiki/Index4extJPAL interesting. I'm going to try this. I knew it existed, but I did not know that PAL was ready to use. I hope to be ready to use me too. I downloaded libpal, and the file COPYING said it was GPL. If I can use PAL, I think that is a very good alternative. Thanks Pietro José María ciao .. pg On Ven, Novembre 21, 2008 07:27, José María Michia wrote: 2008/11/21 Rahkonen Jukka [EMAIL PROTECTED]: Hi, I guess that annotation layers are not supported for this use and you should somehow create a point type layer that acts like the annotation layer. There needs only be two colums in the schema, geometry and name. I don't know it could be done, but have you tried just to change the layer type to point? You are right. The server WFS does not support ANNOTATION layers. I have not tried to change the type of geometry of the layer to point. However, the geometry type of data is polygon, so I can easily convert to centroids. The test that I've done it, is to change the type of geometry of the layer to the type polygon, instead of annotation. In this way, I've moved closer to the goal. But the GML file that I have been able to obtain, is the product of a REQUEST = GetFeature. Because of this, the result contains all elements, not only those items with generalized labels by MapServer. I think that some scripting can be used to read de labels cache, and write the data in a convenient way. I still have not been able to explore this alternative. -Jukka Rahkonen- Thanks Jukka! -Alkuperäinen viesti- Lähettäjä: [EMAIL PROTECTED] puolesta: José María Michia Lähetetty: pe 21.11.2008 5:51 Vastaanottaja: Pietro Giannini Kopio: mapserver-users@lists.osgeo.org Aihe: Re: [mapserver-users] Create a file GML from a layer of typeannotation. Hi, Maybe is useful explain more precisely my goal. The attached image is a PNG obtained by using shp2img. The layer displayed is an ANNOTATION LAYER. The labels are generalized by MapServer. I wish to get the labels displayed in this extent, in this scale, with this degree of generalization, in a GIS format, like GML, or ShapeFile. I wish to use these file in GMT, that no have implemented labeling algorithm. My attempts: 1. shp2img: i obtained PDF files, which can be integrated in the final map using something like Inkscape. 2. WMS: only can obtain a raster image. 3. WFS: I have been able to generate GML files using an WFS request,of type GetFeature. However, GetFeature work on all elements, without caring for the widespread labeling. I do not want all the labels, only those that have been generalized to a certain scale. In the past, I used MapScript. If I remember correctly, I could do this by using a script in PHP or Python. Correct? Thanks for any advice. José María ___ 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