tecnica:gps_cartografia_gis:php_mapscript_recipes
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
tecnica:gps_cartografia_gis:php_mapscript_recipes [2010/01/29 21:18] – niccolo | tecnica:gps_cartografia_gis:php_mapscript_recipes [2010/02/26 23:46] (current) – niccolo | ||
---|---|---|---|
Line 74: | Line 74: | ||
For inline images you can omit web paths, because no temporary images will be created. | For inline images you can omit web paths, because no temporary images will be created. | ||
+ | |||
+ | ===== Make a query ===== | ||
+ | |||
+ | Open an existing map file and perform a **query by rectangle** on a layer, print results with a **template**. | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | $map = ms_newMapObj("/ | ||
+ | $selrect = ms_newrectObj(); | ||
+ | $selrect-> | ||
+ | $map-> | ||
+ | $buffer = $map-> | ||
+ | |||
+ | print "< | ||
+ | print $buffer; | ||
+ | print "</ | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | The **'' | ||
+ | |||
+ | The querable layer is definend in the '' | ||
+ | |||
+ | < | ||
+ | MAP | ||
+ | ... | ||
+ | LAYER | ||
+ | ... | ||
+ | TEMPLATE " | ||
+ | TOLERANCE 6 | ||
+ | METADATA | ||
+ | DESCRIPTION | ||
+ | RESULT_FIELDS | ||
+ | RESULT_HEADERS " | ||
+ | END | ||
+ | END | ||
+ | END | ||
+ | </ | ||
+ | |||
+ | This is an example for **'' | ||
+ | |||
+ | <code html> | ||
+ | <!-- MapServer Template --> | ||
+ | < | ||
+ | </ | ||
+ | |||
+ | This example does not use the template, it **iterates through the query results**: | ||
+ | |||
+ | <code php> | ||
+ | <?php | ||
+ | $map = ms_newMapObj("/ | ||
+ | $selrect = ms_newrectObj(); | ||
+ | $selrect-> | ||
+ | |||
+ | $map-> | ||
+ | $layer = $map-> | ||
+ | $count = $layer-> | ||
+ | |||
+ | print "Query result count: " . $count . "< | ||
+ | print "< | ||
+ | for ($i = 0; $i < $count; $i++) { | ||
+ | $qRes = $layer-> | ||
+ | print_r($qRes); | ||
+ | } | ||
+ | print "</ | ||
+ | ?> | ||
+ | </ |
tecnica/gps_cartografia_gis/php_mapscript_recipes.1264796291.txt.gz · Last modified: 2010/01/29 21:18 by niccolo