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
Errors creating/editing groups and discussions
- Login to post comments
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?
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.
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?
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.
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
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.
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.
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.
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.
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. :)
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).
- Login to post comments
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