template query with mapscript

GREGORY DYKE gregory.dyke at EPFL.CH
Thu Sep 16 07:22:26 PDT 2004


Hi list,

With the aid of Steve Lime, I have managed to produce an svg map with mapserver.

I want to replicate this query with mapscript so as to save this to file and do further processing with php.

I can't figure out which of the mapscript API is usefull to me: processQueryTemplate only gives me the WEB header and footer and processTemplate sigfaults (I'm using mapserver4.2.3, so the problems from back in july should be sorted.)

Here is the cgi query I use:

mapserv?map=/var/www/html/testswiss.map
&mode=itemnquery
&qitem=Tname
&qstring=/./
&qlayer=county

-------------------------------------------------

Here is the mapfile:

MAP
  NAME 'testswiss'
  EXTENT 485410 75285 833838 295935
  STATUS OFF # we don't want a raster map
  UNITS METERS
 # DEBUG

  WEB
    HEADER 'header.svg'
    FOOTER 'footer.svg'
    QUERYFORMAT 'image/svg+xml'
    LOG "problem.log"
  END

  LAYER
    NAME county
    STATUS DEFAULT
  # CONNECTIONTYPE OGR
# CONNECTION "data/SWISSTEST.MIF"
    DATA "swiss.shp"
    TYPE QUERY
    HEADER nap_header.svg
    FOOTER nap_footer.svg
    TEMPLATE nap.svg
  END
END

---------------------------------------

here is the phpfragment I tried:

$map_file="/var/www/html/testswiss.map";
$map = ms_newMapObj($map_file);
$layer = $map->getLayer(0);
$tmparray["mode"]="itemnquery";
$tmparray["qitem"]="Tname";
$tmparray["qstring"]="/./";
$tmparray["qlayer"]="county";
#echo $map->processTemplate($tmparray,MS_TRUE);
#segfaults

echo $map->processQueryTemplate($tmparray);
#only produces header and footer in the WEB object

---------------------------------------------

I hope you can help me. For the curious, here is the (huge) svg this is supposed to generate (and yes, I tried on a reduced file and it still segfaults). You will need internet explorer and adobe svg plugin unfortunately; try clicking on the different surfaces:

http://ic2.epfl.ch/~dyke/swisstest.svg

Greg Dyke


--
e'osai ko sarji la lojban - www.lojban.org



More information about the MapServer-users mailing list