Shapefiles doubts

Apeksha Bhambhani beproject06 at YAHOO.COM
Fri Jan 13 00:52:00 PST 2006


Hi Bill ,
   
  Thanks for your informative reply.
   
  Firstly , let me explain to u what are we doing in our project .We are working on the LAMP platform. We are creating an interactive web application . Users will be provided with a map , on which they can make their own additions and deletions.For example , when a certain user wants to landmark a certain city . 
    Could u help us out with a few of r doubts .
   
   Firstly as the input to the Mapserver will be shapefiles , we will be creating our layers , (EG. Point , Polygon , etc,) with the help of OpenEV.This input will be given to the Mapfile of the Mapserver , which willl in turn give a complete image comprising of all the layers. This map can then be displayed using Php/Mapscript. 
   However , we were wondering as to , how would the changes be rendered dynamically to the map using the shapefiles. When the user enters a certain point , the point details need to be added to MySql. But at the same time to reflect the changes online , dont the changes need to be made even to the shapefile. How else will this point be plotted ? 
   
  Also , we were initially planning on buying Web Mapping Illustrated . However , your book seems to be more relevant , do u think so ( keeping in mind of what our project deals with ) ?
   
  Would it be possible for you to mail us the table-of-contents of your book. We tried searching it online , but the site somehow doesnt open properly.
   
  Thanks once again ,

  Apeksha

Bill Kropla <bill at billkropla.net> wrote:
  Hi Apeksha

I take from the questions you are asking that your experience with digital mapping and GIS is limited. (If I'm mistaken, many apologies.)  I have addressed your questions below:

**************************      
  1.While writing the mapfile , we need to specify the extent of the map . The background map chosen being in PNG image type , how do we get the extent of this image , so as to enter this data in the mapfile . 
   
There are 2 types of spatial data: vector and raster. Shapefile data is an example of vector data; each shapefile contains position information that allows an application to actually draw lines, points and polygons. Raster data is essentially an image that is drawn pixel by pixel and line by line. However, in order to be drawn as a layer in a map, raster data needs to be "geo-referenced", that is, it must contain spatial information that allows the application to coordinate the raster image with vector data. Unfortunately, the PNG format does not allow this - it contains no spatial data.  GeoTiff images do contain this spatial info and this is the format used for spatial applications. You can use FWTools to do the geo-referencing if you have enough ground control points and create your own geoTiff, but this is a fairly advanced topic.

**************************      
  2.In interactive web-mapping , do we need MySql to store the data of the various points being plotted on the map or are the shapefiles sufficient . 

It is not exactly clear what your trying to accomplish, but if you have a set of location coordinates  and wish to plot these on a map, there are a number of ways to do this. If you spatial data is already located in a shapefile, use that. But if you just have a list of locations (in a text file for example) and if the set is small, you can use MapServer's inline feature capability. A map file that does this looks like this (note the point layer)

NAME "Hello World"
SIZE 400 300
IMAGECOLOR 249 245 186
IMAGETYPE png
EXTENT -1.0 -1.0 1.0 1.0
WEB
     TEMPLATE "/var/www/htdocs/hello.html"
     IMAGEPATH "/var/www/htdocs/tmp/"
     IMAGEURL "/tmp/"
END
LAYER                     
     STATUS default
     TYPE point
     FEATURE
          POINTS  0.00 0.00 END
          TEXT "Hello World"
     END # end feature
     CLASS
          STYLE
               COLOR 255 0 0
          END
          LABEL
               TYPE bitmap
          END
     END
END
END

If your set contains more than a single point, just replace the points line with something like the following:

          POINTS  0.00 0.00 0.01 0.01 -0.01 -0.01 END

which will draw 3 points.

If you have a large set of points, you are better off using the MapServer API (called MapScript) that is exposed in various languages like Perl, PHP and Python. You can then use a MySQL database containing location information and use MapScript to create the application in one of the supported languages.

A 3rd option is to use ogr2ogr to convert a text file in CSV format to shapefile format. This is easier to do than learning MapScript but limits the power of your application.

**************************      
  3. We are working on an online project and when a new point needs to be plotted on the map and displayed , how can this data be entered into the shapefiles . We have read somewhere that Mapscripting can be used to convert textfiles to shapefiles . 
  Can you please direct us as to how can that be done ???
   
The remarks to question 2 apply here.

**************************   
  4. We have got to know about this book "Web mapping illustrated - By Tyler Mitchell , O'reilly Publications " . Has anyone used used it for developing an online interactive web-mapping apllication (example editing of maps ).

I can't really speak to the quality of Tyler Mitchell's book, I haven't read it, but the reviews are very good. However, get ready for a shameles plug :^), my book Beginning MapServer: Open Source GIS Development deals exclusively with MapServer and MapScript issues. It begins with the installation of MapServer, discusses basic concepts of GIS and provides a comprehensive introduction to using MapServer including Perl MapScript, Python MapScript and PHP/MapScript. Finally, it includes a complete, interactive mapping application coded in PHP/MapScript that uses MySQL to store the dynamic spatial information used to draw symbols on a map. The source code is available at: www.apress.com/book/bookDisplay.html?bID=443. It is available is an e-book at the same location or from Amazon.com at: www.amazon.com/gp/product/1590594908/
   
I hope this helps.

regards,

Bill Kropla
  


			
---------------------------------
Yahoo! Photos
 Got holiday prints? See all the ways to get quality prints in your hands ASAP.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20060113/acfe52ce/attachment.htm>


More information about the MapServer-users mailing list