No subject


Fri Feb 8 15:06:04 EST 2008


map' where each dot represents a certain number of the teachers in that
ZipCode, but where the dots do not represent the actual locations of the
teachers or a real point on the earth.  I don't believe that this can be
done with standard MapServer, especially if you want the ability to
query the dots.  Even it there is a way to represent the dots on a map,
at that point, they are just symbols, not data.

If you can't (or don't want to) store actual locations for teachers, I
would recommend that you symbolize the polygons using a chloropleth
scheme using classes in your map file.  The user could then query (click
on) the ZipCode Polygon and get a list of the teachers with associated
data).

<elaborate kludge>
I suppose that with mapscript, you could query out the records for
teachers within a polygon from your teachers database (if you have a zip
field in your db), and using an algorithm that you write, create a point
for each teacher in your recordset, distribute the the points within the
boundaries of that polygon (following your own buffering and conflict
resolution algorithms), and then write them to a temporary shapefile
that the user could query.

****note, this is purely conceptual and probably quite resource
intensive to do on the fly.

Of course, my feeling is that even if you can pull this off, it isn't
going to be very intuitive to the user.  Since the locations of the
points have no real meaning, how would the user find the record that
they were interested in?  Do they play 'Mine Sweeper' or 'Husker Du
(game, not band)'?  Even if you use labels, once the density of dots
gets great enough, not all points will be labeled.  My guess is that the
user is either looking for a specific teacher based on name (or other
attribute) or a list of all of the teachers.

</elaborate kludge>


FWIW, I find that dot density maps tend to confuse people leading them
to conclude that the dots actually do represent a point on the earth.

I am not trying to be critical, just trying to conceptually think this
through so you can apply the appropriate MapServer methodologies.

David.



David J. Fawcett
MN Office of Environmental Assistance

>>> Joseph Norris <sirronj at PACBELL.NET> 11/24/2004 10:53:30 AM >>>
Eric

Thanks for the help so far.

What am I trying to accomplish?

1) 1)  Learn how to do simple data display from my Mysql database to a
map -
This I have achieved by coloring the polygons which represent where
certain
teachers are by their zip code within California

2) Add zoom capability to my map so that users can zoom into a polygon
( or
zoom out ) - I have also achieved this

3) When user zooms into a colored polygon - I would like to put an
ellipse
for each teacher in that polygon - This I have not achieved and I am
having
no end of problems trying to achieve


Since this whole deal is a proof of concept type project so that we
will get
the go-ahead for more advanced projects utilizing mapserver,  I would
like
to do it as simply as possible.  I have been more-or-less working on my
own
time to do this because I feel that it will be of great benefit to my
shop.

I am very familiar with ArcView and ArcIMS  from installation to
modification and extension and I have found it be a bit painful to use
-
little or no support for LAMP environments and very windows-centric and
very
very costly.

I hope I have clarified my situation.  As far as data goes -

I have shape files of California with zip code data for the zip region
polygons.

Thanks again for putting up with me.



#Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql) print
@c=map chr
$_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,-68,4,-3,-1,7,1,14,-
68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);

-----Original Message-----
From: UMN MapServer Users List [mailto:MAPSERVER-USERS at lists.umn.edu]On

Behalf Of Eric Bridger
Sent: Wednesday, November 24, 2004 5:50 AM
To: MAPSERVER-USERS at lists.umn.edu
Subject: Re: [UMN_MAPSERVER-USERS] ok - got zoom to work - another
question

On Tue, 2004-11-23 at 17:15, Joseph Norris wrote:
> Thanks Eric - so as I understand you:
>
> MAP
>   NAME CalMap
>   STATUS ON
>   EXTENT 5890870.385 -192053.200 8943310.847 3226086.749
>   IMAGETYPE GIF
>   SIZE 600 600
>   SHAPEPATH
>
"/usr/local/apache/htdocs/mco.communityservers.com/htdocs/maps/teacher/tdata
> "
>   IMAGECOLOR 255 255 255
>   TEMPLATEPATTERN "map"
>
>   SYMBOL
>     NAME 'circle'
>     TYPE ELLIPSE
>     POINTS 1 1 END
>     FILLED TRUE
>   END
>
>
>   LAYER
>     NAME "cal_zp_st"
>     TYPE POLYGON
>     DATA "cal_zp_st"
>     STATUS DEFAULT
>     CLASSITEM "ZCTA"
>
>     CLASS
>         EXPRESSION
>
/94087|90408|94107|95118|94530|74580|95404|93711|94904|92030|94121|91042|961
> 01|94523|95548|95658|92057|92503/
>       STYLE
>         SYMBOL 'circle'
>         SIZE 2
>         COLOR 255 102 102
>       END
>
>     END
>
>     CLASS
>       EXPRESSION /./
>       OUTLINECOLOR 204 204 204
>     END
>   END
>   LAYER
>     NAME "poly_minscale"
>     TYPE POLYGON
>     DATA "cal_zp_st"
>     STATUS DEFAULT
>     MINSCALE ????
>     CLASS
>      SYMBOL 'circle'
>       SIZE 2
>       COLOR 255 102 102
>      END
>   END
>      LAYER
>     NAME "poly_maxscale"
>     TYPE POLYGON
>     DATA "cal_zp_st"
>     STATUS DEFAULT
>     MAXSCALE????
>  I don't know what the class would be if any
>   END
>
>
> END # end map from header
>
> How do I determine the minscale and maxscale?
>
> Thanks
>
> #Joseph Norris (Perl - what else is there?/Linux/CGI/Mysql) print
@c=map
chr
>
$_+100,(6,17,15,16,-68,-3,10,11,16,4,1,14,-68,12,1,14,8,-68,4,-3,-1,7,1,14,-
> 68,-26,11,15,1,12,4,-68,-22,11,14,14,5,15,-90);
>
> -----Original Message-----
> From: UMN MapServer Users List
[mailto:MAPSERVER-USERS at lists.umn.edu]On
> Behalf Of Eric Bridger
> Sent: Monday, November 22, 2004 9:53 AM
> To: MAPSERVER-USERS at lists.umn.edu
> Subject: Re: [UMN_MAPSERVER-USERS] ok - got zoom to work - another
question
>
> At 08:39 AM 11/22/2004 -0800, Joseph Norris wrote:
> >Everyone,
> >
> >I have my zoom working but now I would like to tackle something
else.  I
am
> >putting an ellipse in the zip polygons if there is a 1-more
teachers
there.
> >For each zip there maybe a max of 10 teachers.  I would like an
ellipse
or
> >symbol for each one so that when the user zooms into the polygon
they can
> >see a symbol for each teacher. Can I do this within the class?  If
so how
> or
> >would be the best way to handle this?
>
>
> You can do this in the map file by creating two layers and using
MAXSCALE,
> MINSCALE.
> Layer 1 has one ellipse per zip wherever there are 1-10 teachers.
> MINSCALE is set so that it won't appear when you are zoomed in.
> Layer 2 has one ellipse for each teacher and has MAXSCALE set so that
it
> turns on when Layer 1 is turned off.
>
> Of course if you are using Perl Mapscript you will need to calculate
the
> scale yourself and turn on and off the layers yourself.
> Here's and example:
>
> my $current_scale = calculateScale($map, $imgext[0], $imgext[2]);
> # From mapserver3.6.4: mapscale.c msCalculateScale().  This is not a
> precision thing. We don't worry about
> # msAdjustExtent() since in all our maps, image SIZE has same aspect
ratio
> as the map EXTENT.
> # $minx and $maxx are optional in which case the current extent of
the map
> is used.
>
> # Be careful about the current map's extent. zoomMap() changes the
extents.
>
> sub calculateScale{
>     my ($map, $minx, $maxx) = @_;
>     if(!$minx){
>         $minx = $map->{extent}->{minx};
>         $maxx = $map->{extent}->{maxx};
>     }
>     my @inchesPerUnit = (1, 12, 63360.0, 39.3701, 39370.1, 4374754);
>     my $width = $map->{width};
>     my $units = $map->{units}; # index into unitsPerUnit array
>     my $resolution = $map->{resolution};
>     my $md = $width / ($resolution * $inchesPerUnit[$units]);
>     my $gd = $maxx - $minx;
>     return($gd/$md);
> }

Joseph,
I'm not exactly sure what your data looks like or what you are trying
to
achieve. But by using two layers you can control what exactly is
displayed via different CLASS and EXPRESSION's at different scales.

The scale is determined by the current map's extents, (AFTER any
zooming
in which you calculated new extents based on the zoom direction.

(Actually this call:
my $current_scale = calculateScale($map, $imgext[0], $imgext[2]);
gets the scale of the map which was just submitted, based on:
  @imgext = split(' ', $q->param('imgext')); where imgext is the
extent
just submitted with the form.)

Typically you'd want to call $scale = calculateScale($map) (after your
zoom calculations have changed the map's extents.

What MIXSCALE, MAXSCALE to use in your map file must be determined by
trail and error.

HTH.
Eric



More information about the mapserver-users mailing list