[ka-Map-users] max_extents and EXTENT

Tim Schaub tim at commenspace.org
Wed Jun 7 16:44:08 EDT 2006


> Is there a better way to determine these values other than 
> trial and error? i.e., for a given extent, is there a formula 
> to determine exact maximum scale value for a given display 
> image size (of Width x Height)?

This is not ka-Map specific, but you can figure out map units given
scale, resolution, and screen units.

Given a scale, to get the width of your extent in map units:

Extent Width = Display Width x Scale Denominator / (Resolution x Inches
per Map Unit)

where "Display Width" is the width of your map viewport in pixels,
"Scale Denominator" is the mapserver scale, "Resolution" is the
resolution according to mapserver (default is 72 dpi), and "Inches per
Map Unit" depends on your map units (inches: 1, feet: 12, miles: 63360,
meters: 39.3701, kilometers: 39370.1, decimal degrees: 4374754).

So, for example, if you have a 400 pixel viewport and you want to know
the width of your extent in meters for a scale of 1:250000, use

EW = 400 pixels x 250000 / (72 dpi x 39.3701 inches per meter) = 35228 m
 
If you know of a point that you want centered, subtract & add half of
that width to get the minx & maxx portion of your extent.  Do similar
for the height, miny & maxy.  If you have an extent width (or height)
and want scale, you should be able to flip that around.

Hope that helps,
Tim


> 
> Thanks
> Ramesh
> 
> --- Tim Schaub <tim at commenspace.org> wrote:
> 
> > Hey Ramesh-
> >  
> > > Sorry for not mentioning that my EXTENT and
> > max_extents are
> > > exactly same! In that case I do not expect any
> > difference in
> > > the behavior!
> > 
> > I should have mentioned that both EXTENT and max_extents 
> can both be 
> > overridden by scale.
> > 
> > It could be that I am misunderstanding your problem, but 
> I'm guessing 
> > that your largest scale (in mapserver terms) forces ka-Map 
> to render 
> > an area larger than your EXTENT (and max_extents).  If this is the 
> > case, your EXTENT will be centered in the map viewport - but the 
> > viewport will show an area beyond your EXTENT (and you 
> should not be 
> > able to pan around due to max_extents).  When you zoom in 
> to your next 
> > scale, you can no longer pan to the area outside of your EXTENT 
> > because of your max_extents.
> > 
> > So, the bottom line is that you'll always be able to 
> specify a scale 
> > that violates your EXTENT and max_extents.  Note that this is a 
> > dangerous practice (to specify a scale that requires tiles to be 
> > rendered outside of your EXTENT) if you are relying on pre-caching 
> > tiles.  The pre-caching script doesn't know how big your 
> viewport is 
> > going to be, so it assumes that you don't need more than a 
> 1 metatile 
> > buffer around your EXTENT or max_extents - if specified.
> > 
> > Tim
> > 
> > > 
> > > Ramesh
> > > 
> > > --- Tim Schaub <tim at commenspace.org> wrote:
> > > 
> > > > Hey Ramesh-
> > > > 
> > > > > I have a question regarding max_extents
> > METADATA.
> > > > I have both
> > > > > EXTENT and METADATA max_extents defined in my
> > map
> > > > file. At
> > > > > the highest zoom level(maximum scale), the map
> > > > shows a point
> > > > > X which is very close to the left border of
> > > > 'max_extents' I
> > > > > have defined. But when I zoom-in one level I
> > > > cannot see this. 
> > > > > Basically, I cannot drag that far left. Any
> > ideas
> > > > on why this
> > > > > could be happening?
> > > > 
> > > > The max_extents METADATA option does not
> > override your
> > > scale settings.
> > > > So, if you have a max_extent defined that is
> > smaller than
> > > the extent
> > > > of the map at your highest zoom level (at some
> > browser
> > > window size),
> > > > ka-Map will still display the area outside the
> > max_extents.
> > > >  So, the zoom level
> > > > (scale) has precedence when there is a conflict.
> > > > 
> > > > When you zoom in a bit, you are restricted in
> > panning by
> > > max_extents.
> > > > 
> > > > Let me know if you think something else is going
> > on.
> > > > 
> > > > Tim
> > > > 
> > > > > 
> > > > > Thanks
> > > > > Ramesh
> > > > > 
> > > > >
> > __________________________________________________
> > > > > Do You Yahoo!?
> > > > > Tired of spam?  Yahoo! Mail has the best spam
> > > > protection
> > > > > around http://mail.yahoo.com
> > > > >
> > _______________________________________________
> > > > > ka-Map-users mailing list
> > > > > ka-Map-users at lists.maptools.org
> > > > >
> > > >
> > >
> >
> http://lists.maptools.org/mailman/listinfo/ka-map-users
> > > > > 
> > > > 
> > > 
> > > 
> > > __________________________________________________
> > > Do You Yahoo!?
> > > Tired of spam?  Yahoo! Mail has the best spam
> > protection
> > > around http://mail.yahoo.com
> > > _______________________________________________
> > > ka-Map-users mailing list
> > > ka-Map-users at lists.maptools.org
> > >
> >
> http://lists.maptools.org/mailman/listinfo/ka-map-users
> > > 
> > 
> 
> 
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection 
> around http://mail.yahoo.com 
> 



More information about the ka-Map-users mailing list