[Chameleon] Pixel to Geo Conversion problems

Jeff Hamm
Mon, 1 Mar 2004 21:01:06 -0800
I have:
<CWC2 TYPE="SharedResource" NAME="cwcjsapi" DEBUG="false"/>

Server is RH8, widget is "cwcjsapi.widget.php". Zoom widgets etc don't work
if this is declared in uppercase (ie I get a little slash/circle for a

Its' the whole goCWCJSAPI object that seems to be out of scope for the
widget, which seems rather non-global of it.
I'll poke around some more as I track down my Print widget bug before I make
an attempt at global reconciliation. In the meantime, I'm content with a
working widget :-)

Thanks for your help.


-----Original Message-----
From: J. Delfos []
Sent: March 1, 2004 4:49 PM
To: Jeff Hamm
Subject: Re: [Chameleon] Pixel to Geo Conversion problems


Perhaps your javascript variables are not yet initialised. I'm not sure
whether variables such as goCWCJSAPI.oMap.maxx are initialised before any
javascript is actually used. Perhaps on the "ONLOAD" you can initialise
them with the form variables. The form variable MAP_EXTENTS_MINX would be
the one that could get outdated when you use javascript. What I think
might be happening is that when you zoom, only the javascript map-extents
variables (goCWCJSAPI.oMap.maxx, etc.) get used and updated. As soon as
you use your print widget, it might actually try to access the
MAP_EXTENTS_MINX form variable (which is not up to date). That's why after
every javascript operation (e.g. zoom), it might help to update the form

Are you sure you included the CWCJSAPI widget properly?


--- Jeff Hamm <> wrote:

Thanks for your reply.
I was doing some modifications to create a Query by Polygon function.The
function performs an initial querybypoint to retrieve the initial
shape,which is then used to querybyshape on other layers.
I was having problems grabbing the current map extents, so I implementeda
similar approach to your suggestion, using the form:
$nMinX = {$this->mszHTMLForm}.MAP_EXTENTS_MINX.value.
In trying the goCWCJSAPI approach you suggested, I found that
goCWCJSAPIwas undefined. This might be a more fundamental problem, but for
now Isimply scrapped the values off the form. Is there a definitive test
soI can tell if the CWCJSAPI is functioning?
BTW, I also found it necessary to change the value of nInversePix inthe
pixeltogeo conversion (around line 225 in the map_query.php wrapper)from 1
to 0 for the conversion of x coordinates.
I haven't attempted a fix on the printwidget yet, although I'm surea
similar workaround is doable. Still wondering why the $oMap values
aren'tupdated by the Zoom widget though :-(


"J. Delfos" wrote:I have had similar problems, though not exactly thesame.
The problems I
had were that changes made to the map extent by javascript parts (e.g.
zooming and recentering) were forgotten as soon as I submitted theform;
it went back to the original extent. I patched it by pasting this code
into the "clickUpdateMap" function, in Updatemap.Widget.php:
    {$this->mszHTMLForm}.MAP_EXTENTS_MINX.value = goCWCJSAPI.oMap.minx;
//custom added, not to lose extents
    {$this->mszHTMLForm}.MAP_EXTENTS_MAXX.value = goCWCJSAPI.oMap.maxx;
    {$this->mszHTMLForm}.MAP_EXTENTS_MINY.value = goCWCJSAPI.oMap.miny;
    {$this->mszHTMLForm}.MAP_EXTENTS_MAXY.value = goCWCJSAPI.oMap.maxy;
This makes sure that the form variables for your extent are up to date
compared to what your javascript did, when you submit the form. Perhaps
you should try having it execute this code prior to using the functions
which currently aren't working, to make sure your form variables are
current before it does any processing.
--- Jeff Hamm <> wrote:
> I've previously reported that my PrintWidget did not use the updated
> extents of my DHTML map (e.g. after a zoom operation). It appearsthat
> my 'stock versions' of Query and ROI widgets are also affected (under
> IE5.5).
> In the case of Query, I used debug messages to discover the valuesof
> click coords, and its clearly evident that the min/max extent arealways
> the same. For the ROI widget, defined regions are displayed as though
> the map were displayed at full extent. If I zoom in, define an ROI,the
> region appears scaled and positioned according to the original extents.
> REcenter widget works OK, but it doesn't do a pixeltogeo conversion,so
> I'm wondering where to look for the problem.
> Anyone experiencing similar problems? suggestions?
> To reproduce the problem, try doing a point query at a couple of
> different display extents here:
> Thanks
> Jeff Hamm
> Yukon, CANADA
 _______________________________________________Chameleon mailing

Do you Yahoo!?
Get better spam protection with Yahoo! Mail.

This archive was generated by Pipermail.