# [ka-Map-users] equidistant projection assumption

Paul Spencer pspencer at dmsolutions.ca
Tue Jan 31 21:03:36 EST 2006

```Right, that's not really clear in the code.  ka-Map does assume that
there is a proportional relationship between pixel and geographic
space, but it doesn't assume a geographic projection ... as Daniel
pointed out, MapServer deals with that.  However, ka-Map doesn't
provide any sort of support for working in a different projection
than the map.  For instance, you cannot zoom to a latitude and
longitude using decimal degrees if your map projection is in LCC
using meters (for instance).  The community mapbuilder project has a
projection library in javascript that can do client-side reprojection
in some cases that could be used.  Alternately you could hit a server-
side script to reproject but that would be pretty slow I think :)

Cheers

Paul

On 31-Jan-06, at 6:38 PM, Moran Ben-David wrote:

> Thanks, Daniel.  That was very helpful!  My initial issue/question
> was due
> to my confusion about projections as you pointed out.
>
> As you point out, I'll have to project my lat/lon (absolute) and
> pass the
> projected values to kamap's functions.
>
> Thanks,
> Moran
>
>
>> -----Original Message-----
>> From: Daniel Morissette [mailto:dmorissette at dmsolutions.ca]
>> Sent: Tuesday, January 31, 2006 5:02 PM
>> To: Moran Ben-David
>> Cc: ka-map-users at lists.maptools.org
>> Subject: Re: [ka-Map-users] equidistant projection assumption
>>
>> to, the
>> projected coordinates, usually in meters or feet relative to the
>> projection's origin, are in a cartesian system, i.e. the x and y
>> axis in
>> projected coordinates are linear, and it is safe to use this kind of
>> maths to convert from projected coordinates to pixels and back.
>>
>> This being said, the relationship between geographical coordinates
>> (lat
>> and lon, the absolute/unprojected reference ssytem) and the projected
>> coordinates (x and y in meters, feet, whaetver) is not linear... but
>> MapServer deals with that part inside the mapfile and ka-Map doesn't
>> need to worry about it, unless you would like to offer multiple
>> projection choices to your users in the user interface... in which
>> case
>> you would probably be better with Chameleon or another more gis-ish
>> webmapping framework than with ka-Map.
>>
>> I hope that helps
>>
>> Daniel
>>
>> Moran Ben-David wrote:
>>> Hi all,
>>>
>>>
>>>
>>> I have been going through the kaMap code and noticed what I think
>>> is an
>>> assumption that the projection of the map that it is using is
>>> equidistant.  Am I right?
>>>
>>>
>>>
>>> I am about to write my own version of various functions such as
>>> zoomTo
>>> (where I noticed this assumption), however, I just want to make
>>> sure I'm
>>> not wrong in this before I proceed.
>>>
>>>
>>>
>>> Here's a code snippet (kaMap.js) in zoomTo()
>>>
>>>
>>>
>>> this.cellSize = newScale/(oMap.resolution * inchesPerUnit
>>> [oMap.units]);
>>>
>>> .
>>>
>>> var cpX = cgX / this.cellSize;
>>>
>>> var cpY = cgY / this.cellSize;
>>>
>>>
>>>
>>> The translation there from geo to pixel space seems to assume that y
>>> (pixel) is proportional to y (geo) linearly. I think. am I off track
>>> here entirely?
>>>
>>>
>>>
>>>
>>> Moran Ben-David
>>>
>>>
>>> --------------------------------------------------------------------
>>> ----
>>>
>>> _______________________________________________
>>> ka-Map-users mailing list
>>> ka-Map-users at lists.maptools.org
>>> http://lists.maptools.org/mailman/listinfo/ka-map-users
>>
>>
>> --
>> ------------------------------------------------------------
>>   Daniel Morissette               dmorissette at dmsolutions.ca
>>   DM Solutions Group              http://www.dmsolutions.ca/
>> ------------------------------------------------------------
>
> _______________________________________________
> ka-Map-users mailing list
> ka-Map-users at lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/ka-map-users
>

+-----------------------------------------------------------------+
|Paul Spencer                           pspencer at dmsolutions.ca   |
+-----------------------------------------------------------------+
|Applications & Software Development                              |
|DM Solutions Group Inc                 http://www.dmsolutions.ca/|
+-----------------------------------------------------------------+

```