[OpenLayers-Dev] Custom Layer

Matt Brailsford m.brailsford at think-eng.com
Fri Feb 29 10:47:24 EST 2008


Ok,

I'm trying to get this working, and am almost there. My javascript is currently as follows:

function init()
{
       var map = new OpenLayers.Map('map', {projection: "WGS84"});
       var wms = new OpenLayers.Layer.WMS("OpenLayers WMS", 
            "/source/MaporamaHandler.ashx", 
            {singleTile: true} 
       );
       map.addLayer(wms);
       map.zoomToMaxExtent();
}

In MaporamaHandler.ashx, I grab BBOX in the querystring and split it on the comma.

This currently creates 2 tiles (which should be a whole world view) one with a BBOX of -180,-90,0,90 and the other 0,-90,180,90 

When I pass these value through to the 3rd party webservice it's not bringing back the right positions.

Do I need to convert these into another format?

Many thanks

Matt

-----Original Message-----
From: dev-bounces at openlayers.org [mailto:dev-bounces at openlayers.org] On Behalf Of Matt Brailsford
Sent: 29 February 2008 08:17
To: dev at openlayers.org
Subject: Re: [OpenLayers-Dev] Custom Layer

Excellent, I'll go look into this and give it a try.

Many thanks

Matt

-----Original Message-----
From: Roald de Wit [mailto:rdewit at users.sourceforge.net] 
Sent: 28 February 2008 22:45
To: Matt Brailsford
Subject: Re: [OpenLayers-Dev] Custom Layer

Hey Matt,

You might find that Layer.WMS is sufficient for you. I don't know what
your parameters look like, but you can quite easily build a request URL
doing something like this:

var params  = {
  foo: bar,
  ping: pong
};

var layer = new OpenLayers.Layer.WMS( 
  "Custom Layer", 
  "http://url.to.service/", 
  params, 
  {singleTile: true}
);

This will automatically request your web service. You don't need to give
it a lat/long yourself as this will be done for you!

Btw: I assumed that your layer is a baseLayer. If it isn't and the
projection of your layer is different from the baseLayer one, you'll
need to do some more work. 

Good luck!

Roald

On Thu, 2008-02-28 at 16:48 +0000, Matt Brailsford wrote:
> Hi Guys
> 
>  
> 
> I’m working on a project where I need to offer a google style map
> interface to some maps we are being provided by a 3rd party. The 3rd
> party basically has some webservices which I can query for a map given
> a number of criteria (one being a lat/lng boundary).
> 
>  
> 
> My idea is to create a wrapper around the webservice which would allow
> me to request an image via a defined url with querystring. From
> looking through the code, I believe I would need write a custom Layer
> to do use this as it is not a standard protocol.
> 
>  
> 
> Could anyone offer my some starting points on writing a custom layer
> for this? The image being returned would be an image for the whole map
> are (not tiled). Could I just extend the OpenLayers. Layer.Image class
> and override the moveTo and getUrl methods to return the dynamic
> image?
> 
>  
> 
> Could you also let me know how I would integrate this? Could I just
> create a js file for my custom class and import this on the page and
> import the OpenLayers js file remotely?
> 
>  
> 
> And finaly, I tend to use jQuery for my javascript development
> purposes, will using OpenLayers cause any conflicts what with it being
> based on prototype?
> 
>  
> 
> Many thanks
> 
>  
> 
> Matt
> 
> 
> _______________________________________________
> Dev mailing list
> Dev at openlayers.org
> http://openlayers.org/mailman/listinfo/dev
-- 
Roald de Wit
Software Engineer
roald.dewit at lisasoft.com

Commercial Support for Open Source GIS Software
http://lisasoft.com/LISAsoft/SupportedProducts/

_______________________________________________
Dev mailing list
Dev at openlayers.org
http://openlayers.org/mailman/listinfo/dev


More information about the Dev mailing list