You need to log in before you can comment on or make changes to this bug.
A user reported a problem when he converted to mapserver 4.4...his mapfile can be viewed in MapEdit preview but cannot be viewed in GMapFactory. I can also reproduce the error. If I remove the need to reproject the data in the mapfile my gmapfactory application works fine (the map image is displayed). If I change globprefs.php to use mapscript_42 (and force mapserver to reproject) the gmapfactory application works perfect. Definite problem with 4.4 and projections for GMapFactory. The map image appears blank on the page, but using setenv MS_ERRORFILE these errors occur: Sat Nov 27 15:11:05 2004 - msInsertHashTable: Hash table error. Invalid hash table or key Sat Nov 27 15:11:05 2004 - msInsertHashTable: Hash table error. Invalid hash table or key Sat Nov 27 15:11:05 2004 - msProcessProjection(): Projection library error. projection not named Sat Nov 27 15:11:05 2004 - msProcessProjection(): Projection library error. projection not named
I've managed to narrow the problem to one line, in ~/yourgmapfactoryapp/wrapper/map_session.php if I comment out the following line my application works with both php_mapscript 42 and 44: line 845 $this->oMap->setprojection(implode( "\n", split( " ", $aszKeys["SRS"] ) )); Can someone explain what this line is supposed to do? here is some more of the code: function restoreState(...) { ... // set the projection if not empty if ( isset($aszKeys["SRS"]) && $aszKeys["SRS"] != "" ) { // srs can contain "=" $this->oMap->setprojection(implode( "\n", split( " ", $aszKeys["SRS"] ) )); } ... }
ok, before someone answers "it's supposed to set the projection"...yes but why would this cause an error with mapscript 44 and not 42? and if it's not a necessary line I think it should be removed.
note that problem occurs with mapserver 4.4-beta2 and beta3.
The following error: msProcessProjection(): Projection library error. projection not named is likely caused by passing an empty projection to setProjection(). i.e. in the code that you quoted, $aszKeys["SRS"] would be empty. The maintainer of the wrappers stuff should look into that. If you'd expect that passing an empty projection should unset it, then please file a enhancement bug in MapServer. With respect to the other error: msInsertHashTable: Hash table error. Invalid hash table or key You'd get that if you call setMetadata() with a null hashtable, key or value. However I can't seem to reproduce that even by passing null value explicitly to the function. If someone can create a test case that reproduces this and submit a mapserver bug then I can have a look.
Paul and Zak just helped me debug this. It appears to be a bug in phpmapscript's setProjection() function. $oMap->setProjection(" init=epsg:42304"); // notice the space with phpmapscript_44_beta2&3.dll --> throws error with phpmapscript_42.dll -- no error 42 looks to be using a trim() function whereas 44 is not.
This is not new to MapServer 4.4: I get the same error with both versions on my machine. Perhaps something changed in PROJ? Can you find out which versions of PROJ were used by your respective builds of MapScript?
FYI I'm using PROJ 4.4.8 for both php_mapscript 4.2 and 4.4 and I get this "projection not named" error in both cases when I pass " init=epsg:42304". Let's see which versions you have. I CC'd Frank, he may be aware of some changes in PROJ that could have cause that.
To state the obvious, EPSG:42304 is not a real EPSG projection and is not distributed in the normal "epsg" definition file. It is distributed with PROJ.4 in the other.extra file. Have you pasted the other.extra file into your epsg definition file?
That's not the problem Frank: the problem is the space at the beginning of the projection string. It seems that PROJ 4.4.8 (at least) doesn't like receiving " proj=..."
Ah, sorry. That's what I get for not reading over things carefully.
I'm using PROJ: Rel. 4.4.6, 3 March 2003
sorry my turn for misunderstanding. Assefa believes both 4.2 and 4.4 mapscript versions used the same proj (build in July 2003)
Um... maybe we could patch MapServer to trim leading spaces but that implode( "\n", ...) doesn't smell good anyway. I tested this code and it won't work with projection definitions with more than one parameter unless you prefix your projection parameters with "+", in which case you don't need the implode at all since passing a "+"-delimited string directly works. The right way to pass projection definitions to PROJ are using "+" prefixes, or comma-separated parameters with no spaces: "+init=epsg:42304" or "+proj=lcc +ellps=GRS80 +lat_0=49 +lon_0=-95 +lat_1=49 +lat_2=77 +datum=NAD83 +units=m" or "proj=lcc,ellps=GRS80,lat_0=49,lon_0=-95,lat_1=49,lat_2=77,datum=NAD83,units=m" The reason why "init=epsg:42304" also works it's because it falls in the comma-separated case.
Paul, Zak, Bill, we ran into this again and need some answers on this. The following code from map_session.php can't work for the reasons explained in comment #13 above. Can whoever wrote it please explain why this implode("\n", split(...)) is there? If not then I'll take it out: // set the projection if not empty if ( isset($aszKeys["SRS"]) && $aszKeys["SRS"] != "" ) { // srs can contain "=" $this->oMap->setprojection(implode( "\n", split( " ", $aszKeys["SRS"] ) )); }
Never mind. I have removed the bogus implode() in php_utils/wrapper/map_session.php. If you know of a better fix then please go ahead. Not sure in which maplab release this will be included.
thank you
To shed a bit more light on the subject, after a quick check, I have found that the implode was added in version 1.50 (I wont say by who ;)). The comment says: "fixed handling of projection through URL if it was a multiline projection definition." Paul do you recall what you meant by that? Is this going to cause issues? .....oops sorry....I guess I let the cat out of the bag ;)