[OpenLayers-Users] Custom Map tiles

Mike Quentel mquentel at rim.com
Mon Aug 25 12:01:24 EDT 2008


OpenLayers most likely can be modified to work with your map server.  I
use an in-house-developed custom map server not available outside my
company; so I had to implement custom layer classes to handle data
requests to my map server.  Some general advice... 

1) Get an untiled version working: 

What I did to get my first OL custom map client prototype working was to
create an OL class that works just like the Untiled class.  In your
current map server, if you know how to have a map displayed based on a
simple URL call to your server (like the anotherhost.com URL you mention
below), you should be able to create a class that appends the "lat",
"lng", "scale", "height", and "width" parameters to an HTTP request from
OL.  Mimic the Untiled class example.  The purpose of this step is to
get a simpler version of OL client working with your server before you
add the greater complexity of tiling functionality.  Think of this as a
proof-of-concept/test example to answer the question "can OL talk to my
map server and render a map?".  It can also be something you can quickly
show your boss to show progress.

2) Get a tiled version working:

Once you have untiled working, then try to get tiling functionality
working.  You will want a class named something like
"OpenLayers.Layer.MyCustomClass".  Using the bounding box (top, left,
bottom, right) data for each untiled map image produced by each zoom
level, you can calculate (figure this out mathematically in a script or
by hand) the representative fractions (or alternatively, the
resolutions) needed for each zoom level.  When obtaining these top,
left, bottom, right degree (metre, or whatever) measurements of the
bounding box, I suggest you use an output image at 256 x 256 pixels (or
whatever you plan to use in your tile size in OL).  Using the list of
representative fractions (or resolutions) you can then set up the map
like this, replacing the list of "scales" numbers with your own list of
representative fractions (or use the "resolutions" attribute for a list
of resolutions)... 

////////////////////////

var olOptions = {
    controls: [],
    tileSize: new OpenLayers.Size(256, 256),
    scales:
[4375.522883858268,8751.061146653543,17502.122293307086,35004.2292076771
6,70008.47379429133,140016.93220964566,280033.8644192913,560067.72883858
26,1120135.4576771653,2240270.9307332677,4480541.830708661,8961083.50762
7953,17922165.661909446,35844320.17408957,71688539.24704725,143375987.52
76821]
}; 

olMap = new OpenLayers.Map("olmapdiv", olOptions);

myCustomMapServerLayer = new OpenLayers.Layer.MyCustomClass('My Custom
Map Server', 'http://www.anotherhost.com/gettile.asp?', {buffer: 1,
fractionalZoom: true});

olMap.addLayer(myCustomMapServerLayer);

///////////////////////

The above advice is very general.  Mimic the example OL Layer classes
for your custom class.

Cheers,
 
Mike Quentel


-----Original Message-----
From: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org]
On Behalf Of Kenny France
Sent: Monday, 25 August 2008 10:47
To: Users at openlayers.org
Subject: [OpenLayers-Users] Custom Map tiles

Hi Guys,
 
I am currently getting map tiles from a commercial provider,  that i
don't wish to say who at this time.
 
i can pull single tiles from their map server but the only way i can do
this is using the following...
 
http://www.anotherhost.com/gettile.asp?lat=12.123456&lng=12.123456
<http://www.anotherhost.com/gettile.asp?lat=12.123456&lng=12.123456&scal
e=10&height=800&width=800> &scale=10&height=800&width=800
 
this will supply me with a  with a single tile at a specific zoom level
that is 800X800, the lat and lng supplyed is the center of the tile
 
My question is.......
 
is there anyway i can intergrate this tile with openlayers?
or is there anyone that fancies a challange that can help me with this,
i am prepared to pay if someone can help me
 
Thanks
 
K-
 
 

________________________________

I am using the free version of SPAMfighter for private users.
It has removed 37698 spam emails to date.
Paying users do not have this message in their emails.
Try SPAMfighter <http://www.spamfighter.com/len>  for free now!


---------------------------------------------------------------------
This transmission (including any attachments) may contain confidential information, privileged material (including material protected by the solicitor-client or other applicable privileges), or constitute non-public information. Any use of this information by anyone other than the intended recipient is prohibited. If you have received this transmission in error, please immediately reply to the sender and delete this information from your system. Use, dissemination, distribution, or reproduction of this transmission by unintended recipients is not authorized and may be unlawful.



More information about the Users mailing list