Opened 15 years ago
Last modified 15 years ago
#2975 new enhancement
PHP Mapscript should only update the parameters specified
Reported by: | youknowho | Owned by: | mapserverbugs |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | MapScript-PHP | Version: | 5.2 |
Severity: | normal | Keywords: | |
Cc: |
Description
Extra undefined/unwanted parameters are being appended to a map file when using PHP MapScript. The additional information that is added is:
STYLE ANGLE 360 OPACITY 100 SYMBOL 0 END
As an example, a CLASS that originally looks like:
CLASS EXPRESSION ([pixel] >= 155 AND [pixel] < 164) COLOR 28 28 28 END
becomes:
CLASS EXPRESSION ([pixel] >= 155 AND [pixel] < 164) STYLE ANGLE 360 COLOR 28 28 28 OPACITY 100 SYMBOL 0 END END
after using the following MapScript code to change ONLY the DATA parameter:
<?php // Grab POST parameters $mapFile = $_POST['mapFile']; $layerString = $_POST['layers']; // Separate layers on comma $layers = explode(",", $layerString); // Load MapServer .map file $map = ms_newMapObj($mapFile); // Update map file with each layer for ($i = 0; $i < sizeof($layers); ++$i) { $layerPrefix = explode("_", $layers[$i]); $layer = $map->getLayerByName($layerPrefix[0]); // Change DATA parameter for layer $layer->set("data", 'path/to/data/' . $layers[$i]); } // Finished editing, save .map file $map->save($mapFile); ?>
The expected behavior is that PHP MapScript will only update the specified DATA parameter and nothing else.
Note:
See TracTickets
for help on using tickets.
Using the same PHP MapScript code originally posted, PHP MapScript is changing more than first noted. The following changes occur:
MAP configuration before script:
MAP configuration after script:
The layer that I am dynamically changing starts as:
and after PHP MapScript runs looks like:
Through a flag, configuration, directive, etc for PHP MapScript, please enable it to ONLY change the parameters supplied in the script, and not alter/add/remove additional map parameters.