[mapserver-users] Back to basics...

E.Perik erwin at perik.nu
Thu Sep 12 06:12:21 EDT 2002


Hi Tony,
 
Example of creating a layer from a shapefile:
 
Used
http://mapserver.gis.umn.edu/wilma/mapserver-users/0110/msg00154.html
Then did following:
 
0) Create map-object
1) Get object/points from existing-shapefile or from in this case, your
database
2) Put it in new-shapefile (as you did in your php-script)
3) Create dbf-file with name of new-shapefile
4) Clear new-shapefile
5) Add new-layer to map-object (default of this layer is set to OFF)
6) Show new-layer (turn it ON)
7) Draw the map (now includes newly created shapefile ;-) )
 
Explanation:
 
*** In 0) you use like: $Map = ms_newMapObj("blabla.map");
 
*** In 1) you determine input. This could be the 3 points you have in
your example, but also could be a shape or lat/lon from a database (eg.
dbf/MySQL)
 
*** Option 2) and 3) and 4) you have in your mapscript. This creates a
shapefile + corresponding dbf-file.
 
*** Option 5) and 6) is best done using a dummy-layer which is set to
OFF in your map-file. You turn it on AND attach the new shapefile-data
from by using:
      $Dummylayer = ms_newLayerObj($Map);  // a new layerobject
      $Dummylayer = $Map->getLayerByName("MapLayer");  
      $Dummylayer->set("status", 1);             // Turn it on 
      $Dummylayer->set("data", $shpFname);       // Add your created
data
 
      While your map-layer looks something like:
 
      LAYER
        NAME "MapLayer"
        TYPE POINT
        STATUS OFF
        CLASS
          SYMBOL 'circle'
          COLOR 0 0 0
          SIZE 3
        END
      END
 
*** Option 7) is something like:
 
$ImgMap = $Map->draw();
 
This should do the trick.
 
Erwin
 
 
 
-----Original Message-----
From: owner-mapserver-users at lists.gis.umn.edu
[mailto:owner-mapserver-users at lists.gis.umn.edu] On Behalf Of
wendyandtony
Sent: donderdag 12 september 2002 0:26
To: mapserver-users at lists.gis.umn.edu
Subject: [mapserver-users] Back to basics...
 
Hi
 
I'm doing a small personal project where I'd like to search an Oracle
database via a website using Perl/cgi (not too difficult), but then
display the query as points on a (simple) map. The data base is of
historic/prehistoric sites so all I need to map are points. I'm
(gratefully) using an evaluation version of MapInfo Pro 7 and have
access to university servers etc. It seems that MapServer is suited to
this, but my query here is ..er.. how do I get started?
 
Kind regards
 
Tony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapserver-users/attachments/20020912/a36e0908/attachment.html


More information about the mapserver-users mailing list