Using WMS layers with j2memap library….

By admin • mai 24th, 2007

In the latest release of J2memap library, a new interface has been defined: MapCustomOverlay

If you create a class that implements MapCustomOverlay, you will have the ability to dsiplay new layers on top of an existing map.

The implementation is easy, there are two methods:

   String getTileURL(int x,int y,int z,int sizeSq,boolean isSat);

and

    public boolean isTransparent();

  The last one just have to return true if transparent, or false otherwhise. The getTitleUrl must return to URL of a tile to be loaded at the corresponding x,y positions. sizeSq is the size of a square, usually 256, while isSat is true if the user is currently displaying a satellite image.

  To convert x “pixels values” into longitude, you can use MapCanvas.LonFromX() and MapCanvas.LatFromY() for y value.
  To display this layer, call the setOverlay(MapCustomOverlay) function (with null parameter to remove it). Just one overlay can be displayed at a time.
  This can be used to easily create WMS overlay, if you know the URL of a WMS server.

  Latest question, is: great, but what happens if I do not want to program and I want to be able to display a custom layer? Well, something good is coming, but if you want to test it, just drop me an email

 

Leave a Comment

« J2memap V09.20 | Home | GoogleMaplet: Map Widgets…. »