Zoomscale (Integer data type?)

Ed McNierney ed at TOPOZONE.COM
Tue Feb 8 10:57:19 PST 2005


Kevin -

Are you confusing what zoomScale does?  It zooms to a certain scale,
centered on the coordinates at a pixel location in a map image.  If you
are calculating the pixel on which a particular coordinate lies, you can
certainly do that, and you may well end up with a fractional pixel
value.  For example, if you have a zoomed-out view where each pixel is
one degree wide and one degree high, then the point (45.9, 22.6) might
appear to lie at pixel coordinate 122.9, 66.4 (measuring Y increasing
downward, so the .6 becomes .4.

However, it is impossible to center that map image on (45.9, 22.6), at
least at that scale.  You can center it on an integer pixel coordinate,
and you can zoom in to reduce the pixel size and increase the resolution
of your integer pixel location.

        - Ed

Ed McNierney
President and Chief Mapmaker
TopoZone.com / Maps a la carte, Inc.
73 Princeton Street, Suite 305
North Chelmsford, MA  01863
ed at topozone.com
(978) 251-4242 

-----Original Message-----
From: Kevin Grootendorst [mailto:kgrootendorst at BAIRD.COM] 
Sent: Tuesday, February 08, 2005 1:49 PM
To: MAPSERVER-USERS at LISTS.UMN.EDU; Ed McNierney
Subject: Re: Zoomscale (Integer data type?)

OK, so If I get the 'real' pixel value of the point of interest, I
should be able to use something like this to zoom to the point:

$oMapNavigator->zoomPoint(250, $px1, $py2);

So then something must be wrong with the way I convert lat-long to
pixels...

Thanks.

Kevin



On Tue, 8 Feb 2005 13:29:46 -0500, Ed McNierney <ed at TOPOZONE.COM> wrote:

>Kevin -
>
>zoomScale zooms to a given scale centered on a pixel in the image, 
>presumably a pixel that was clicked on.  The pixel coordinates (that 
>is, the X and Y coordinates in the image) of the pixel of interest must

>be integers, as you can't click on the right half of a pixel, for
example.
>
>They're not the spatial (geographic) coordinates of the point, which 
>might not be integers.  Pixel coordinates must be integers.
>
>        - Ed
>
>Ed McNierney
>President and Chief Mapmaker
>TopoZone.com / Maps a la carte, Inc.
>73 Princeton Street, Suite 305
>North Chelmsford, MA  01863
>ed at topozone.com
>(978) 251-4242
>
>-----Original Message-----
>From: Kevin Grootendorst [mailto:kgrootendorst at BAIRD.COM]
>Sent: Tuesday, February 08, 2005 1:25 PM
>To: MAPSERVER-USERS at LISTS.UMN.EDU; Ed McNierney
>Subject: Re: Zoomscale (Integer data type?)
>
>Ed,
>They're supposed to represent the location of a point.
>
>Info:
>Spatial reference: NAD83, DD.
>Original extents: (-93 38 -74 51)
>Map Size (600 x 475) w x h
>Longitude/Latitude of point: -79.606, 43.496
>
>Kevin
>
>
>On Tue, 8 Feb 2005 13:16:51 -0500, Ed McNierney <ed at TOPOZONE.COM>
wrote:
>
>>Kevin -
>>
>>You can't have a fractional pixel - what are those extents supposed to

>>represent?
>>
>>        - Ed
>>
>>Ed McNierney
>>President and Chief Mapmaker
>>TopoZone.com / Maps a la carte, Inc.
>>73 Princeton Street, Suite 305
>>North Chelmsford, MA  01863
>>ed at topozone.com
>>(978) 251-4242
>>
>>-----Original Message-----
>>From: UMN MapServer Users List [mailto:MAPSERVER-USERS at LISTS.UMN.EDU]
>>On Behalf Of Kevin Grootendorst
>>Sent: Tuesday, February 08, 2005 1:01 PM
>>To: MAPSERVER-USERS at LISTS.UMN.EDU
>>Subject: [UMN_MAPSERVER-USERS] Zoomscale (Integer data type?)
>>
>>Does anybody know how to force 'ZoomScale' to recognize double or 
>>float
>
>>data types, instead of treating numbers as integers?
>>
>>I have the following extents (in pixels):
>>$px = 417.4;
>>$py = 290.6;
>>
>>Using ZoomScale:
>>$oMapNavigator->zoomScale( 25000, $px1, $py2);
>>
>>The map actually zooms to the point (417,290) which causes my point to

>>appear off centered.  I want to have the point centered.
>>
>>Thanks.
>>
>>Kevin



More information about the MapServer-users mailing list