OpenSeaMap Forum

For new registrations: Please create and activate an account. Afterwards send an email to forum.openseamap@gmail.com including a short message and your username to get write access to this forum. Thanks!
Für neue Registrierungen: Bitte erstelle einen neuen Account und schalte ihn frei. Anschließend sende eine kurze Mail mit deinem Nutzernamen an forum.openseamap@gmail.com um Schreibzugriff für dieses Forum zu bekommen. Danke!

You are not logged in.

#1 2020-10-01 10:39:53

talofa
Member
Registered: 2015-06-23
Posts: 2

depth tiles access for better routing

Hi everybody,
since more than 5 years I am collecting depth data for northern Germany, Denmark, etc.
I can see all the beautiful tracks in my browser, all my ones and all of yours. Great!

Obviously chances are very high, that we are mostly using the same routes through the waters when sailing arround.
It would be much better to choose the routes via areas which are still white (or blue) without any depth data available.

I am using the adroid app "oruxmap"s with my charts captured via "mobac_atlas". It would be really great to have offline available the depth-layer with all tracks on the screen when sailing, in order to choose, which way to sail, e.g., by means of an overlay layer.

I have not found a way, how to access a tile layer with depth tracks overlay information, e.g. similar to https://tiles.openseamap.org/seamark/{$z}/{$x}/{$y}.png.

To be clear: I do not need the depth data in meters, I just need to track points to choose untouched waters for collecting data.

Any ideas.

Greetings from Talofa

Offline

#2 2020-10-02 11:33:51

kannix
Member
From: Ruhrgebiet
Registered: 2013-10-27
Posts: 148
Website

Re: depth tiles access for better routing

Hi, you might as well open an issue at https://github.com/OpenSeaMap

Hope this helps, Dirk

Offline

#3 2020-10-04 07:23:32

talofa
Member
Registered: 2015-06-23
Posts: 2

Re: depth tiles access for better routing

This mapsource for mobac_atlas will generate the tiles layer with the depth tracks:

/** 
beanshell code to use the depths tracks of openseamap

put it into your "mapsources"-directory...

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>

**/


static import java.lang.Math.*;

name = "tracks";

tileType = "png";

tileSize = 256; // optional
minZoom = 6;   // optional
maxZoom = 17;   // optional

/**
This method is called for each tile: 
input parameters for this script: "zoom", "x" and "y"
**/
String getTileUrl( int zoom, int x, int y ) {
return ("https://depth.openseamap.org/cgi-bin/mapserv.fcgi?LAYERS=contour,contour2,trackpoints_merged_10&NUMZOOMLEVELS=22&TYPE=png&TRANSPARENT=TRUE&SERVICE=WMS&VERSION=1.1.1" + 
"&REQUEST=GetMap&STYLES=&FORMAT=image%2Fpng&SRS=EPSG%3A900913&BBOX=" +  mercatorTileEdges(x,y,zoom) + "&WIDTH=256&HEIGHT=256") ;
} 

numTiles(z){
    return abs(pow(2,z));
}

mercatorToLat(mercatorY){
  return(toDegrees(atan(sinh(mercatorY))));
}

latEdges1(y,z){
  n = numTiles(z);
  unit = 1 / n;
  relY1 = y * unit;
  lat1 = mercatorToLat(PI * (1 - 2 * relY1));
  return lat1;
}

latEdges2(y,z){
  n = numTiles(z);
  unit = 1 / n;
  relY1 = y * unit;
  relY2 = relY1 + unit;
  lat2 = mercatorToLat(PI * (1 - 2 * relY2));
  return lat2;
}

lonEdges1(x,z){
  n = numTiles(z);
  unit = 360 / n;
  lon1 = -180 + x * unit;
  return lon1;
}

lonEdges2(x,z){
  n = numTiles(z);
  unit = 360 / n;
  lon1 = -180 + x * unit;
  lon2 = lon1 + unit;
  return lon2;
}

tileEdges(x,y,z){
  return (latEdges2(y,z) + "," +
   	  lonEdges1(x,z) + "," +
	  latEdges1(y,z) + "," +
	  lonEdges2(x,z));
}

lon2mercator(l){
  return (l * 20037508.34 / 180);
}

lat2mercator(l){
 r = toRadians(l);
 lat = log((1+sin(r)) / (1-sin(r)));
 return (lat * 20037508.34 / 2 / PI);
}

mercatorTileEdges(x,y,z){
  return (lon2mercator(lonEdges1(x,z)) + "," +
          lat2mercator(latEdges2(y,z)) + "," +
	  lon2mercator(lonEdges2(x,z)) + "," +
	  lat2mercator(latEdges1(y,z)));
}

I combined it with my favorite map Eniro-nautical  as follows:

<customMultiLayerMapSource>
	<name>Eniro_tracks</name>
	<tileType>PNG</tileType>
    <backgroundColor>#000000</backgroundColor>
    <layersAlpha>1.0 0.8</layersAlpha>
	<layers>
		<mapSource>
			<name>Eniro-nautical</name>
		</mapSource>
		<mapSource>
			<name>tracks</name>
		</mapSource>
	</layers>	
</customMultiLayerMapSource>

Last edited by talofa (2020-10-04 10:16:00)

Offline

Board footer

Powered by FluxBB