[OpenLayers-Users] is it possible to use .map directly with openlayers?

Christopher Schmidt crschmidt at metacarta.com
Wed Sep 3 07:13:42 EDT 2008


On Wed, Sep 03, 2008 at 09:31:20AM +0700, Deli Soetiawan wrote:
> Hi there,
> 
> is it possible to directly use .map file as layer on OpenLayers? if  
> possible what method i have to call? maybe something like below, say i use  
> gmap file on MS4W located on "/ms4w/apps/gmap/htdocs/gmap75.map"
> var basemap = new OpenLayers.Layer.????("Gmap 75",  
> "/ms4w/apps/gmap/htdocs/gmap75.map")
> //dunno exactly what layer should i choose

If you have MS4W, you have MapServer. The second parameter should look
like:

  'http://localhost/cgi-bin/mapserv?map=/ms4w/apps/gmap/htdocs/gmap75.map"

> or can someone explain how to use OpenLayers with KaMap, ussually in KaMap  
> i just have to configure map i use as base on config.php and all set, i  
> have take alook kamap.txt (and renamed into kamap.php) but i didn't  
> understand much with the kamap.html

Yes, OpenLayers does configuration in the client side, not the server
side. Specifically, you'll need to:
  * Set extents/scales that match ka-Map in OpenLayers (on the Map)
  * Create a Layer.KaMap("name", "url/of/kamap.php")

You may also need to provide different tile size, since OL defaults to
256x256 and ka-Map defaults to 200x200.  

If you are currently using ka-Map, I do *not* recommend using the
kamap.txt file from OpenLayers. Instead, start with the output of your
config.php, and configure OpenLayers to match. If you get stuck, include
the output of config.php, and your current OL configuration, in another
email to the list.

> i use KaMap for current WebGIS project and i hope these were easy way to  
> migrate into OpenLayers

"Easy" is relative. Typically, ka-Map comes configured as a viewer
application out of the box. OpenLayers doesn't really do that; you'd
need to build your own app that did the same things. 

Regards,
-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list