php/mapserver & wms

Previous Topic Next Topic
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view

php/mapserver & wms

David Percy
Nelson, Here is some sample PHP/Mapscript code from one of our apps here
at PSU. Others have found it useful, I hope you do, too :-)

//start sample code
    $cities->set("name", "Cities");
    $cities->set("data", "all_cities_dissolved");
    $cities->set("type", MS_LAYER_POLYGON);
    $cities->set("status", MS_OFF);
    $cities->set("transparency", 20);
    $cities->set("classitem", "NAME");
    //next few lines are to enable querry
    $cities->set("group", "Selectable Layers");
    $cities->setMetaData("Description", "City");
    $cities->setMetaData("Result_Fields", "NAME");
    $cities->setMetaData("Group", "Selectable Layers");
    $cities->setMetaData("Layer", "cities");

    $class_cities_lrg->set("name", "Large Cities");
    $class_cities_lrg->setExpression("/Metro Area/");
    $class_cities_lrg->set("maxscale", 10000000);
    $class_cities_lrg->set("minscale", 5000001);
    $class_cities_lrg->set("template", "ttt_query.html");

    $class_cities_med->set("name", "Medium & Large Cities");
    $class_cities_med->setExpression("([AREA] > 0.01)");
    $class_cities_med->set("maxscale", 5000000);
    $class_cities_med->set("minscale", 500001);
    $class_cities_med->set("template", "ttt_query.html");
//end sample code

David Percy
Geospatial Data Manager
Geology Department
Portland State University

> Date: Thu, 2 Nov 2006 08:43:54 -0600
> From: Nelson Guda <[hidden email]>
> Subject: [Mapserver-west] php/mapserver & wms
> To: [hidden email]
> Message-ID: <[hidden email]>
> Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed
> Hi all,
> I have a site that uses mapserver wms to generate tiles which overlay  
> on top of a google map.  I would like to make the mapserver tiles  
> user-customizable, so that the wms call can return a map that  
> reflects a query (for example a map that shows several but not all of  
> the species in the postgre database, or just records from specific  
> years).  The reason I am overlaying the mapserver tiles on the google  
> map is that we have too many points for the google api to plot, and  
> it is much faster this way.
> Can php/mapserver be used to generate custom wms such as this?  If  
> so, is there a good tutorial on how to do it?
> If not, does anyone have any better suggestions of how to generate  
> customized wms layers from a postgre database?
> many thanks,
> nelson

Mapserver-west mailing list
[hidden email]