[mapserver-users] "simple" scale problem?

Paul Spencer pspencer at dmsolutions.ca
Fri Oct 9 17:09:53 PDT 2009


Actually the extent of your shapefile is very much smaller than that  
of your map file.  Try using a smaller extent, say

-122.42 37.73 -122.41 37.74

(hope I got that the right way around)

Cheers

Paul

On 2009-10-09, at 7:50 PM, Alan Swithenbank wrote:

> Hi,
>
> My first post here, (I just signed on 5 minutes ago), so pardon any  
> missed
> protocols...;^)
>
> I'm absolutely new to mapserver, but, well versed in coding,  
> graphics, and
> system administration in general. I'm trying to display a shapefile
> via perl mapscript. I created the the shapefile using the perl  
> shapelib
> module. (It's GPS track data). The shapefile displays as expected  
> using
> openjump, so I think it is OK. Here is the ogrinfo -al output for the
> shapefile:
>
>
>   INFO: Open of `track2shp.shp'
>         using driver `ESRI Shapefile' successful.
>
>   Layer name: track2shp
>   Geometry: Line String
>   Feature Count: 1
>   Extent: (-122.419903, 37.739453) - (-122.419775, 37.739625)
>   Layer SRS WKT:
>   (unknown)
>   ID: Integer (10.0)
>   Date: String (16.0)
>   OGRFeature(track2shp):0
>     ID (Integer) = 0
>     Date (String) = 353238-19-8
>     LINESTRING (-122.419881799999999
>   37.739624999999997,-122.419860400000005
>   37.739539100000002,-122.419774500000003 37.7394533,-122.4199033
>   37.739496199999998)
>
>
> In my map file I've given a size 800 400, and an
> extent -123.00 37.00 -122.00 38.00, with units dd. I do
> get a display, but what I see is just a tiny spot within
> the 800x400 area, rather than a show of the shapefile
> data at what should be a reasonable scale from the extent.
> It appears that the extent is ignored, and some arbitrary
> scaling is applied the 800x400 area. (By the relative sizes
> it appears maybe to be 360x180 degrees.)
>
> I'm guessing there is some projection and/or scale issue,
> or something like defining a .wld file for a raster image
> required, but, haven't been able to crack it. I'd appreciate
> any pointers. Here's the full .map file:
>
>   MAP
>
>     NAME "simpleshowmap"
>     SIZE 800 400
>   #  IMAGECOLOR 64 136 32
>     IMAGETYPE PNG
>     SHAPEPATH
>   "/home/alans/Desktop/mapserverdemo/minigtopp/perlaccess/track2shp/"
>     EXTENT -123.00 37.00 -122.00 38.00
>     UNITS DD
>
>     WEB
>       TEMPLATE
>   "/home/alans/Desktop/mapserverdemo/minigtopp/perlaccess/ 
> simpleshow.html"
>       IMAGEPATH "/home/alans/Desktop/mapserverdemo/tmp/"
>       IMAGEURL "/tmp/"
>     END
>
>    LAYER
>       NAME "tracklayer"
>       STATUS default
>       TYPE line
>       DATA "track2shp"
>       CLASS
>         STYLE
>           COLOR 255 0 0
>         END
>       END
>     END
>
>  END
>
> And, for completeness, the perl mapscript file:
>
>   #!/usr/bin/perl -w
>
>   use strict;
>   use mapscript;
>   use CGI ":cgi";
>
>   my $script_name = "/cgi-bin/simpleshow.pl";
>
>   my $map_path = "/home/alans/Desktop/mapserverdemo/minigtopp/ 
> perlaccess/";
>   my $map_file = "simpleshow.map";
>   my $img_path = "/home/alans/Desktop/mapserverdemo/tmp/";
>
>   my $img_name = sprintf("simpleshow%0.6d",rand(1000000)).".png";
>   my $params = new CGI;
>   my $map = new mapscript::mapObj($map_path.$map_file);
>   my $img = $map->draw();
>   $img->save($img_path.$img_name);
>
>   print $params->header();
>   print $params->start_html(-title=>'Simple Perl Mapscript Shapefile  
> Show',
>                             -bgcolor=>"#E6E6E6");
>   print <<END_OF_HTML
>   <br>
>   This code, simpleshow.pl, used perl mapscript to display the ESRI
>   shapefile track2shp.shp, (produced by the routine track2shp.pl),
>   according to the dictates of the .map file simpleshow.map.
>   <br><br>
>   <form name="pointmap" action="simpleshow.pl" method="POST">
>   <input type="image" name="img" src="../../tmp/$img_name">
>   </form>
>   END_OF_HTML
>   print $params->end_html();
>
>
> thanks!
>
> Alan Swithenbank
> Research Programmer
> Stanford University
> Tagging of Pacific Pelagics Project
>
>
>
>
>
>
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users


__________________________________________

    Paul Spencer
    Chief Technology Officer
    DM Solutions Group Inc
    http://research.dmsolutions.ca/




More information about the MapServer-users mailing list