[ka-Map-users] Manipulating the URL 'CPS' parameter

Steve Walker walker at mfgis.com
Mon Jul 16 19:04:17 EDT 2007


I have re-worked certain of my maps to change from geographic coordinates
to a Mercator projection.

This has caused one issue to arise:  Certain legacy URL links (eg possible
end-user bookmarks and/or search engine results) may have an associated
cps (center point-scale) parameter such as:

http://myurl?cps=-121,45,50000

Since I am using PostGIS, doing the actual coordinate transformation is
easy enough:

# select x(transform(PointFromText('POINT(-121 45)',4326),3395)), \
         y(transform(PointFromText('POINT(-121 45)',4326),3395));

       xmin        |       ymin
-------------------+------------------
 -13469658.3859861 | 5591295.91855339
(1 row)

So the question is then how to prepare and pass the query to postgis, and
replace the lat long coordinates with their projected equivalents.

One idea is to use mod_rewrite in apache (at which I am a neophyte)

A second idea is to use  $_GET['cps'] in my index.php (Question:  But is
it already too late to have an affect upon startUp.js ?? )

A third idea is to do something within startUp.js itself (Question:  But
is this confusing the client-side and server-side roles?)

A third-and-a-half idea is to make an AJAX call within startUp.js to the
server in order to perform the transformation.

A fourth and last-result idea would be to simply discard the CPS values
within startUp.js when their x-y coordinates are within [-180,180] and
[-90,90] respectively.

Any ideas/insights would be appreciated.

-Steve
-- 
Steve Walker
Middle Fork Geographic Information Services
walker at mfgis.com
360-671-2505



More information about the ka-Map-users mailing list