Remove necessity for php tile resolution script
The conversion script now generates a proper directory structure with z/y/x coords in the path.
This commit is contained in:
		
							parent
							
								
									105dc4d3da
								
							
						
					
					
						commit
						f17bf1ebb0
					
				@ -132,7 +132,7 @@ function load_svg(name, url, active=1) {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function load_tiles(name, id) {
 | 
					function load_tiles(name, id) {
 | 
				
			||||||
	var satellite = L.tileLayer('https://notsyncing.net/maps.linux-forks.de/tiles/?id={id}&z={z}&x={x}&y={y}', {
 | 
						var satellite = L.tileLayer('https://notsyncing.net/maps.linux-forks.de/tiles/{id}/{z}/{y}/{x}.png', {
 | 
				
			||||||
		maxZoom: 14 /*8*/,
 | 
							maxZoom: 14 /*8*/,
 | 
				
			||||||
		maxNativeZoom: 6,
 | 
							maxNativeZoom: 6,
 | 
				
			||||||
		minNativeZoom: 0,
 | 
							minNativeZoom: 0,
 | 
				
			||||||
 | 
				
			|||||||
@ -1,14 +0,0 @@
 | 
				
			|||||||
<?php
 | 
					 | 
				
			||||||
	$x = intval($_GET['x']);
 | 
					 | 
				
			||||||
	$y = intval($_GET['y']);
 | 
					 | 
				
			||||||
	$z = intval($_GET['z']);
 | 
					 | 
				
			||||||
	$id = preg_replace("/[^a-z0-9\-]/", "", $_GET['id']);
 | 
					 | 
				
			||||||
	if (strlen($id) > 30) die();
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	$hdr = "Location: /maps.linux-forks.de/tiles/$id/$z/" . str_pad($y * (2**$z) + $x, 5, "0", STR_PAD_LEFT) . ".png";
 | 
					 | 
				
			||||||
	if (isset($_GET["debug"])) {
 | 
					 | 
				
			||||||
		echo $hdr;
 | 
					 | 
				
			||||||
	} else {
 | 
					 | 
				
			||||||
		header($hdr);
 | 
					 | 
				
			||||||
	}
 | 
					 | 
				
			||||||
?>
 | 
					 | 
				
			||||||
@ -41,7 +41,7 @@ while true; do
 | 
				
			|||||||
	fi
 | 
						fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	echo "  Generating tiles..."
 | 
						echo "  Generating tiles..."
 | 
				
			||||||
	convert $tempfile -crop ${TILESIZE}x${TILESIZE} +adjoin $out/%05d.png
 | 
						convert $tempfile -crop ${TILESIZE}x${TILESIZE} +adjoin $out/%d.png
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
	rm $tempfile
 | 
						rm $tempfile
 | 
				
			||||||
	
 | 
						
 | 
				
			||||||
@ -51,3 +51,16 @@ while true; do
 | 
				
			|||||||
	crop=$(($crop * 2))
 | 
						crop=$(($crop * 2))
 | 
				
			||||||
	zoom=$(($zoom + 1))
 | 
						zoom=$(($zoom + 1))
 | 
				
			||||||
done;
 | 
					done;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					echo "Renaming files..."
 | 
				
			||||||
 | 
					for (( z=0; z<=$zoom; z++ )) {
 | 
				
			||||||
 | 
						echo "Zoom level $z"
 | 
				
			||||||
 | 
						fac=$((2**$z))
 | 
				
			||||||
 | 
						for (( y=0; y<$fac; y++ )) {
 | 
				
			||||||
 | 
							outdir="$MAPNAME/$z/$y"
 | 
				
			||||||
 | 
							mkdir $outdir
 | 
				
			||||||
 | 
							for (( x=0; x<$fac; x++ )) {
 | 
				
			||||||
 | 
								mv $MAPNAME/$z/$(($fac * y + $x)).png $outdir/$x.png
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user