Skip to Content

Errors creating/editing groups and discussions

21 replies [Last post]
archaeogeek
Offline
Joined: 2009-10-27

When logged in as admin, if I try and create a new discussion, with a map defined, and a config document, I get the following error:
ERROR: P0001: SQLSTATE[P0001]: Raise exception: 7 ERROR: Schema 'Test' is not a valid schemaname
CONTEXT: SQL statement "SELECT AddGeometryColumn($1, $2, $3, $4, $5, $6)" pl/pgSQL function "addgeometrycolumn" line 9 at SQL statement
The discussion isn't created.
Then when I try to edit groups (add users to them, create new groups) I get an error Parseerror:undefined when I hit apply, and my changes are not saved.
Any thoughts (I'm using the version 20091028)
Jo

mgleahy
Offline
Joined: 2007-07-17

It would appear that the first error has to do with the use of capital letters in the discussion name, which is used to create the schema.  Try it with lowercase for the time being.  I'll have to do something to handle this.
As for editing groups, I'm not able to duplicate that error.  Could you give me a step-by-step recreation of what you do from the point of logging in to recreate the problem?

archaeogeek
Offline
Joined: 2009-10-27

I slowly figured out the first problem myself by manually running the discussion_schema.sql file and watching the errors!
I get the second problem by logging in as admin, and choosing manage user groups. I choose to edit a group (say admin) and add members to it. I close the members window, and hit apply. Then I get the error. I also get it if I start a new group, give it a name, a description, tick the admin box, tick the public box, add members (close the members window) and hit apply.
I've also come across another problem whilst working through the discussion_schema.sql file. I get errors because the columns set as geometrycolumns don't actually exist in the tables. So, event_log is supposed to have geometry columns extent and geom, but it doesn't, as far as I can tell. So the addgeometrycolumn function works in that it adds records in the geometry_columns table, but the spatial indexing fails because the columns don't actually exist. I can add them manually to get it to work for now though.
Thanks!
Jo

archaeogeek
Offline
Joined: 2009-10-27

OK, scratch the last comment- I figured out what was going on with the addgeometrycolumn problem, and I was talking rubbish!
Jo

mgleahy
Offline
Joined: 2007-07-17

I'm still unable to replicate your issue with creating users and groups...would you be able to email me a dump of your mapchat database (mgleahy at alumni.uwaterloo.ca)?
The geometry column issue could be something to do with PostGIS 1.4 (I'm still working with 1.3.x - but I'll upgrade shortly and see where that gets me).  However, any errors that occur during the creation of a discussion using the utility should be displayed to you.  If you use the discussion management utility to try creating a fresh discussion, do you still have missing geometry columns?  If you manually create one from the discussion_schema.sql, you would have to replace all instances of '?' with the name of the discussion schema (preferrably an alphanumeric string using all lowercase letters, starting with a letter, and optionally numbers and/or underscores) - you would also have to enter the appropriate data (mapfile, config file, description, etc.) in the main discussions table in the database.

mgleahy
Offline
Joined: 2007-07-17

Heh, ok - you replied while I was typing again.  :)
Another question (if you're still having the group editing errors): what version of PostgreSQL & PHP are you working with?

archaeogeek
Offline
Joined: 2009-10-27

OK, making some progress! I've got php 5.2.4 and postgresql 8.3.3, postgis 1.4.
I dropped the whole mapchat2 database and re-initialised it, and started with a discussion with a lower case name this time, as I wasn't helping myself with trying to sort things out manually! I got the same parserror:undefined when trying to add a user or group to the new discussion, even though I was trying to add "everyone" to it. When I looked in the database I saw that the discussion was created but there was no entry in the table group_discussions, so I added an entry in there, and could then see my map available for use.
 
I then had a whole bunch of problems with my mapfile (my bad), which I resolved, but I'm now stuck. I choose my mapfile, and get a page with a mapchat logo at the bottom right, but nothing else. Firebug gives me the following information:
For the request line GET /mapchat2/kamap/init?sid=d8f7078dd0ee0a2ce9b750164f9ad3ce HTTP/1.1
<br />
<b>Warning</b>:  [MapServer Error]: msLoadMap(): Undefined symbol "hatch" in class 0, style 0 of layer User Drawings (polygon).
 in <b>/var/www/mapchat2/library/MapChat/Discussion/Map.php</b> on line <b>193</b><br />
<br />
<b>Warning</b>:  [MapServer Error]: msAddImageSymbol(): Error opening image file /var/www/mapchat2/maps/hatch.
 in <b>/var/www/mapchat2/library/MapChat/Discussion/Map.php</b> on line <b>193</b><br />
<br />
<b>Warning</b>:  Failed to open map file MAP
  EXTENT -961830 4104724 8775699 8590518
  FONTSET "fonts.lst"
  IMAGECOLOR 245 245 245
  IMAGETYPE AGG_PNG24
  SIZE 800 800
  MAXSIZE 4000
  STATUS ON
  UNITS METERS
  CONFIG PROJ_LIB "/usr/share/proj"
  CONFIG MS_ERRORFILE "stderr"
  NAME "MS"

  OUTPUTFORMAT
    NAME "AGG_PNG24"
    MIMETYPE "image/png"
    DRIVER "AGG/PNG"
    EXTENSION "png"
    IMAGEMODE "RGBA"
    TRANSPARENT TRUE
  END

  OUTPUTFORMAT
    NAME "AGG_JPEG"
    MIMETYPE "image/jpeg"
    DRIVER "AGG/JPEG"
    EXTENSION "jpg"
    IMAGEMODE "RGB"
    TRANSPARENT FALSE
    FORMATOPTION "QUALITY=75"
  END

  OUTPUTFORMAT
    NAME "GD_GIF"
    MIMETYPE "image/gif"
    DRIVER "GD/GIF"
    EXTENSION "gif"
    IMAGEMODE "PC256"
    TRANSPARENT FALSE
  END

  SYMBOL
    NAME "rail"
    TYPE TRUETYPE
    CHARACTER "|"
    GAP -3
    FONT "sc"
    POSITION CC
  END

  SYMBOL
    NAME "path"
    TYPE SIMPLE
    PATTERN
      1 1
    END
  END

  SYMBOL
    NAME "dash"
    TYPE SIMPLE
    PATTERN
      3 3
    END
  END

   in <b>/var/www/mapchat2/library/MapChat/Discussion/Map.php</b> on line <b>193</b><br />
<br />
<b>Fatal error</b>:  Call to a member function setMetaData() on a non-object in <b>/var/www/mapchat2/library/MapChat/KaMap/Init.php</b> on line <b>151</b><br />
 
At this point I'm stuck!
Thanks
 
Jo
 
 

mgleahy
Offline
Joined: 2007-07-17

You need to have symbols and fonts defined in your mapfile with the FONTSET and SYMBOLSET parameters.  I see you have 'fonts.lst' defined, but keep in mind that the path used here is relative to the maps folder.  You'll see there are already two font and symbol files located in maps/etc, and you can use those by putting the following in your mapfile:
 
   SYMBOLSET "etc/symbols.sym"
   FONTSET "etc/fonts.txt"
 
The other 'parserror' issue you're still having with editing user/group membership for the discussion is still a mystery to me.  Perhaps you could look at the apache error logs (or ssl error logs if you've got HTTPS setup).  Also, if you can setup the Firebug extension in Firefox, perhaps you could monitor the AJAX request that is sent when creating a discusion and/or editing user and group memberships - the response text might be a bit more revealing.

archaeogeek
Offline
Joined: 2009-10-27

OK, I' understand. I didn't need those parameters for my existing mapfile (or rather I needed fonts.lst with the fonts for my layers), so I've added them but I'm having terrible trouble persuading mapchat to pick up the changes. I've logged out and logged back in, and also found the tmp/ms_tmp file in my web root directory, and I've deleted all the files in there, but it still shows fontset fonts.lst in the error message! Any ideas?
 
Jo

mgleahy
Offline
Joined: 2007-07-17

Mapchat stores cached copies of the mapfile for each user that logs into each discussion (so that changes to the user's map layers are retained at the next login).  I guess the error you ran into happened after the mapfile got cached.  If you delete these ('delete from <discussion_name>.user_maps;'), it should default to the mapfile the next time you open the discussion.
Because of this, it's a good idea to test the mapfile to make sure it works before loading it into mapchat.  For example, I use the mapserv CGI executable to render the map - if there are problems with the mapfile, it should be revealed.  There are probably other ways to do it by commandline, but this works for me: http:// localhost/cgi-bin/mapserv?mode=map&map=/var/www/bv/maps/<mapfile_name>&layers=all

archaeogeek
Offline
Joined: 2009-10-27

Yeah, I've tested my map in a web page and it works fine. I now get all the map tools etc, but no actual map. I'm wondering if I''ve missed something very basic. Mapchat is looking for a layer group called "User Drawings", but I assumed this was created automatically rather than a layer I had to define myself in the map file, since the install instructions don't mention it. Or should I be defining this somehow? If so, what data type and details should I put in for the User Drawings layer?
 
Would it be possible to see a demo map file? By all means delete the connection details and so on, but I'm not convinced I have all the requisite components in mine.
 
Thanks
 
Jo

mgleahy
Offline
Joined: 2007-07-17

You're correct about the user drawings - those are automatically added to the map.  The tiles not loading could be any number of issues.  Did you try the Firebug extension?  If so, see if you can grab the URL for a tile and try loading it in the browser to see if it shows any errors (and/or check Apache's logs for errors).  You could also check the tile cache folder to see if any tiles are actually being rendered (Note: if you change the appearance of layers in the mapfile, you'd also have to clear out this cache as well as the user_maps table).
 
Here's a couple sample layers from a mapfile that I have:
 
LAYER
NAME "Satellite Imagery" # You can use regular text here, but avoid characters like <,>,"...basically anything that could mess up the HTML
      GROUP "RASTER" # This determines which map layers are rendered in different image tile layers.
      STATUS OFF
      TILEINDEX "/data/LANDSAT_IMAGES/index.shp"
      TILEITEM "LOCATION"
      TYPE RASTER
      #MINSCALE 100000 # I haven't implemented much in the UI to deal with min/max scale but this is less important with the ka-Map tile caching
      #MAXSCALE 350000
      METADATA
         "mapchat_display_group" "Imagery" # this group determines how the layer is listed in the UI
         "imageformat" "AGG_JPEG" # the first layer in a GROUP determines this, but I add it to all layers to be sure.
         "mapchat_fields" "x  y  value_0  value_1  value_2" # these are tab-separated column names that you want displayed in a mapscript query result for this layer (must be defined if you want to exclude some columns and/or if you want to use column aliases).
         "mapchat_aliases" "Grid X-Coordinate   Grid Y-Coordinate Red Value   Green Value Blue Value" # these are the aliases for the columns listed above
      END
END
 
LAYER
      NAME "A sample polygon layer" # You can use regular text here, but avoid characters like <,>,"...basically anything that could mess up the HTML
      GROUP "VECTOR" # This determines which map layers are rendered in different image tile layers.
      DATA "<shapefile>"    #spatial data to process
      STATUS OFF  #Sets the current status of the layer.
      TYPE polygon  #Specifies how the data should be drawn. Need not be the same as the shapefile type.
      OPACITY 50  #Sets the opacity level (or the inability to see through the layer) of all classed pixels for a given layer.
    
      METADATA
         "mapchat_display_group" "Vector data" # this group determines how the layer is listed in the UI
         "imageformat" "alpha" # the first layer in a GROUP determines this, but I add it to all layers to be sure.
            # NOTE: 'alpha' is needed for multiple image layers (GROUPs) to have translucency for filled-in areas.  Otherwise, specify one of the imageformats above.
      END

      PROJECTION  #
         "init=epsg:26909"
      END

      #TEMPLATE "ttt_query.html"   # this is not needed...it's legacy from the CGI MapServer design - without this parameter set, mapscript doesn't actually return query results.  However, MapChat2 will handle this whenever a query is executed.

      LABELITEM "GID"  #Specifies the attribute to label these with

      CLASS  #You have to have a CLASS or the layer will not display at all
         NAME "All"
         EXPRESSION('true' eq 'true')

         STYLE
            COLOR 95 251 33 # a bright green
            WIDTH 2
         END #STYLE
         LABEL  #This specifies how objects falling into this class will be labelled
            COLOR  0 0 0 # a bright green
            FONT sans
            TYPE truetype
            SIZE 8
            POSITION CC
            PARTIALS FALSE
            OUTLINECOLOR 95 251 33  #against a bright green background
         END #LABEL
      END #CLASS
END
 
Mostly what is required for MapChat2 to work is the layer name, group, and the various metadata elements - I tried to cover these in the instructions, but if something is missing, feel free to point it out.  Everything else is configuration/styling that is normally required for any MapServer mapfile.
 
 

archaeogeek
Offline
Joined: 2009-10-27

I've changed the colour of my map to virulent yellow, so I can see that it's displayed, and it is. I have one vector layer and one raster layer, and neither of them display. When the map is first loaded, both layers are unticked in the layer control, so I tick them and get the parseerror:undefined message. I reload the map using the map controls, or zoom out to the maximum extent, and the layers stay ticked but still don't appear. There doesn't seem to be any error message from apache or mapserver. The page information (in firefox) shows lots of yellow tiles, along with some blank (?) gifs, the page furniture, and a png showing the symbol I'm using for my vector layer. There aren't any errors in the mapserver logs or apache logs, that I can see...
 
I'm totally stuck now!
 
Jo

mgleahy
Offline
Joined: 2007-07-17

Ok...when you get the parseerror, that's where it would be useful to see the content of the AJAX response (e.g., using Firebug).  Is your server web-accessible?  If so, I could give it a shot and see what I find - feel free to send me an email with the login information and a URL/ip address.

mgleahy
Offline
Joined: 2007-07-17

Have you made any progress with this?  I've been thinking about this, and I'm wondering if maybe your PHP is returning notices or warnings that are corrupting the AJAX responses.  You can set the error reporting level in the php.ini file, and/or turn on or off the display of errors (if set to off, I think you can only see them in log files) - you'd have to restart the Apache service.  I'm still not able to reproduce a 'parseerror' situation, but something different on your system might be producing new notices or warnings that I haven't encountered - as long as it isn't an actual error, then it should work fine if you can suppress the messages.
 
In any case, I'd still be keen to see the output of the AJAX responses that cause these errors.

archaeogeek
Offline
Joined: 2009-10-27

Sorry, I was at a conference yesterday (actually demoed mapchat and got a good response!)- I'll take a look at this today but I'm still waiting for my boss to open up external access to the server.
 
Cheers
 
Jo

mgleahy
Offline
Joined: 2007-07-17

Ok, I've spotted at least one problem that would be a configuration issue.  I accessed the URL you gave me, but I don't have a login yet.  I tried registering for an account, but noticed the CAPTCHA image isn't displayed.  The actual error in this case is a 404 response for the image url (e.g., "/ms_tmp/6c69a56561bcdf6b73e2827a17da6033.png").
 
Take a look at the config.php in the mapchat library folder.  You'll find some settings that refer to various paths in there.
 
First, make sure $tmpDir points to an absolute path that is writable by the apache service.
 
Next, if you have a ramdisk setup make sure the path to that is correct  (a ramdisk is basically a partition of ram used as a virtual drive - good for lots of read/write access to small files like php sessions).  I actually meant to comment this out by default - I'll fix that.
 
Finally, you need to make sure any of the settings that require web-accessible paths are properly set (e.g., for image tiles, legend icons, CAPTCHA images).  Basically, all of the defaults in config-dist.php point to [$tmpDir]/ms_tmp/ as an absolute path for writing images to (i.e., $tmpWeb and $CaptchaConfig->imgDir), and '/ms_tmp/' as the web-accessible path that browsers can access (i.e., $tmpWebURL and $CaptchaConfig->imgUrl).  You need to make sure this folder exists, is writeable by the apache service, and is configured to be web-accessible so that browsers can read the files that are written there.  You should find after you have successfully loaded a map, you will start to find tiles images that have been generated being stored in a cache sub-folder (default is 'mccache' - also set in config.php).
 
These should be noted under step 3 in the INSTALL file (except for the CAPTCHA settings, which are recently added - if you don't see that bit at the end of the config.php file, you may have to copy it from a new version of config-dist.php).
 
So it may be the $ramDir setting that's messing up some parts related to the 'parseerror' messages, while the $tmpDir and $tmpWebURL etc will be causing problems when loading maps and other images that are generated on the server.
 
Let me know if this resolves things for you.

archaeogeek
Offline
Joined: 2009-10-27

I've double-checked the settings in the config file, and had missed the stuff on the captcha, which I've sorted, but images have always been saved in the temp directory. I've told php not to output errors, and that seems to resolve the parse error problem (in that the message doesn't appear), but when I try and edit group membership of a discussion the changes don't seem to always get saved. When I try and draw on the map, nothing happens (the drawing window comes up, I select polygon, draw on the map, but nothing shows up) and I can't measure either...
 
Jo

mgleahy
Offline
Joined: 2007-07-17

Ok, the CAPTCHA image now appears.  I just tried editing group membership, and I can't add members to the group.  Since there's no parseerror happening, it's now clear that there was something causing some kind of error message to be output into the AJAX response.  But you're going to have to turn the error reporting back on so we can see it.  :)

archaeogeek
Offline
Joined: 2009-10-27

done!

archaeogeek
Offline
Joined: 2009-10-27

OK, done that and restarted apache.

mgleahy
Offline
Joined: 2007-07-17

As it turns out, PHP on Ubuntu by default has magic_quotes_gpc set to 'On' in the php.ini file, which was causing quotes in JSON text to be escaped with backslashes.  Setting this to 'Off' in the ini file solves the problem.  It will also be added as a setting in the sample .htaccess file included with the MapChat code so that the problem should be avoided altogether in the future.

 
As for the problem identified with the drawing tool, this is due to PostGIS's new feature in 1.4 that adds an 'L' command to SVG output from the st_assvg in order to be standards-complient.  To deal with, this the code on line 186 of html/js/MapChat/Canvas.js needs to have '.split(" L").join("")' added to it, so it should look like the following:
 
    var subPaths = svg.split(" Z").join("").split(" L").join("").split("M ");
 
Also, it is important to note that if using decimal degrees (or any similarly large units) as the reference coordinates in a map, you'll want to increase the <precision> value in the xml config file used along with the map (it's currently set to 0, which rounds to the nearest integer - this is fine for UTM coordinates, but a higher value of 6 would be more appropriate for decimal degrees).