[Mapserver-users] Code Sharing

woodbri at swoodbridge.com woodbri at swoodbridge.com
Thu Mar 13 07:59:33 EST 2003


This is a good idea and we already have a good start at this with the 
wiki - check out:
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PHPMapScript
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PerlMapScript
http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?JavaScriptMapServer

as examples. This nice thing about this is it gives people pages that 
document their code examples etc. It would be nice if wiki had an 
upload feature for files because some examples are just to big to be 
copy and pasted ti a wiki page.

But I would resist having yet another dumping ground. Another 
possibility for those that want to figure out CVS is to create and 
area there for code snippets and application, but it think wiki is 
probably more user friendly.

Just my $ 0.02,
  -Steve W.

On 13 Mar 2003 at 7:56, Stefan Schwarzer wrote:

> Hi all,
> 
> while the discussion about splitting the list is taking shape, I would
> like to introduce another idea: A site to share code.
> 
> Almost everybody familiar with GIS will know about ESRI's Script site.
> Anyone can post his developed scripts there, with a description of
> what it is doing and how to integrate it. Ok, this is a bit different
> of what MapServer users would have to offer. But the idea, that the
> same procedure mustn't be developed several times but only once and
> reused by others, would be perhaps nice for MapServer as well.
> 
> An example would be perhaps the code below, posted today/yesterday. Or
> the Javascript code for drawing bounding boxes on the map. (This one
> was posted a couple of weeks ago. I for example reused and extended it
> a bit, so that after a rectangle-query has been send, the same
> rectangle will be drawn again on the newly generated map. So the user
> can see the result of his query and the query-area at the same time. I
> would be happy to share this piece of code..) Or some basic cut-outs
> of code - how one produces a query, how one puts up a connection to a
> database with related queries, how one re-projects his layers
> on-the-fly, etc.
> 
> I think that this could be useful on one side for beginners and
> advanced developers at the same time. But, right, the case is not as
> clear as for ArcView scripts....
> 
> Best wishes,
> 
> Stefan
> 
> 
> 
> 
> >Bill,
> >
> >Here are the essentials:
> >
> >$qmode = MS_SINGLE or MS_MULTIPLE;  ### pick one
> >
> >$point = ms_newPointObj();
> >$point->setXY($x, $y);
> >
> >$map = ms_newMapObj(MAPFILE);
> >for ($i=0; $i<$map->numlayers; $i++) {
> >
> >     $layer = $map->getLayer($i);
> >     $layer->set('status', MS_ON);
> >     $ret = @ $layer->queryByPoint($point, $qmode, -1.0);
> >     if ($ret == MS_SUCCESS) {
> >     $numResults = $layer->getNumResults();
> >     $layer->open($shapepath);
> >
> >     for ($j=0; $j<$numResults; $j++) {
> >             $res = $layer->getResult($j);
> >             $shp = $layer->getShape($res->tileindex, $res-
> > >shapeindex);
> >
> >             #  add code to get attributes from the shp object
> >             #  add code to get geometry from the shp object
> >
> >             $shp->free();
> >     }
> >     $layer->close();
> >}
> >
> >MS_SINGLE gives you the close object within TOLERANCE of the $x, $y
> >and MS_MULTIPLE gives you ALL objects within TOLERANCE.
> >
> >I use code similar to this to do my reverse geocoder. You can check
> >it out at http://imaptools.com/demos1/?tab=4
> >
> >-Steve W.
> >   http://imaptools.com
> >
> >On 12 Mar 2003 at 16:33, Hudspeth, Bill wrote:
> >
> > > Can anyone send me example code and/or and explanation of how I
> > > would go about using PHP mapscript to perform single and multiple
> > > queries. I know that there is an example in the GMap demonstration
> > > files that uses the Rosa applet, but I would prefer at this point
> > > to avoid using it and to rely exclusively on mapscript.
> > >
> > > Thanks, Bill
> > >
> > > ******************************************************************
> > > ***
> > > ******************************************************************
> > > *** William Hudspeth, PhD Earth Data Analysis Center 107 Bandelier
> > > Hall West University of New Mexico Albuquerque, NM  87131 (505)
> > > 277-3622, ext. 238 bhudspeth at edac.unm.edu wbhk at unm.edu
> > >
> > >
> >
> >
> >_______________________________________________
> >Mapserver-users mailing list
> >Mapserver-users at lists.gis.umn.edu
> >http://lists.gis.umn.edu/mailman/listinfo/mapserver-users
> 
>          _______________________________________
> 
>          Stefan Schwarzer
>          Consultant on GEO
> 
>          UNEP/DEWA/GRID-Geneva
>          Chemin des Anemones 11
>          CH - 1219 Chatelaine
>          Switzerland
> 
>          Tel: (+41) 22.917.83.49
>          Fax: (+41) 22.917.80.29
> 
>          Email: stefan.schwarzer at grid.unep.ch
>          Internet: http://geodata.grid.unep.ch/
>          _______________________________________ 





More information about the mapserver-users mailing list