+++ /dev/null
-<?\r
-require_once("../../path_index.php");\r
-$srs=$_GET['proj'];\r
-$up=$_GET['up'];\r
-$dpi=$_GET['dpi'];\r
-$bbox=$_GET['bbox'];\r
-$format=$_GET['format'];\r
-$dpi=$_GET['dpi'];\r
-$user=$_GET['user'];\r
-$folder=(rand()%300);\r
-$width=round($_GET['width']);\r
-$height=round($_GET['height']);\r
-\r
-\r
-//mkdir("download/",0777);\r
-//chmod("download/$user/$folder",0777);\r
-$URL_SITE="http://edit.br.fgov.be";\r
-$URL_GEOSERVER="http://193.190.116.6:8080/geoserver/wms";\r
-$path="download";\r
-//genus sld path\r
-if ($_GET['sld_path'])\r
-{\r
-$sld_path=$_GET['sld_path'];\r
-}\r
-if ($_GET['serialized_sld'])\r
-{\r
-$serialized_sld=$_GET['serialized_sld'];\r
-}\r
-\r
-if ($_GET['sp_sld_paths'])\r
-{\r
-$sp_sld_paths=$_GET['sp_sld_paths'];\r
-}\r
-if ($_GET['fourth_sld_paths'])\r
-{\r
-$fourth_sld_path=$_GET['fourth_sld_paths'];\r
-}\r
-\r
-if ($_GET['grids'])\r
-{\r
-$grids=$_GET['grids'];\r
-}\r
-if ($_GET['untiled_sld'])\r
-{\r
-$untiled_sld=$_GET['untiled_sld'];\r
-$untiled_sld=explode('|',$untiled_sld);\r
-}\r
-if ($_GET['scalebar'])\r
-{\r
-$scalebar=$_GET['scalebar'];\r
-}\r
-if ($_GET['windrose'])\r
-{\r
-$windrose=$_GET['windrose'];\r
-}\r
-\r
-\r
-// $x=$width*$up;\r
- $white="white_images/white".$width.".png";\r
-//if ($_GET['untiled']){\r
-$untiled=$_GET['untiled'];\r
-$untiled=explode('@',$untiled);\r
-$untiled=array_reverse($untiled);\r
-$u=array();\r
-$u2=array();\r
-\r
-$count=0;\r
-foreach ($untiled as $k3=>$v)\r
-{\r
-//4*topp:grid2|grids\r
-//3*layer1,style1|layer2,style2\r
-$untiled=explode('*',$v);\r
-//$u[$untiled[0]]['position']=$untiled[0];\r
-$position=$untiled[0];\r
-\r
-$info=$untiled[1];\r
-\r
-\r
-$info=explode('|',$info);\r
-\r
-$count=$count+count($info);\r
-//layer1,style1 layer2,style2\r
-//topp:grid2,grids\r
- foreach ($info as $k=>$v)\r
- {\r
-//geometry_type--->polygon: fill_color/stroke_color/stroke_style\r
-//polygon/\r
-//untiled=1|topp:UTM_Europe,UTM_Europe/faf7c6@2|topp:country_earth,world_negro\r
-\r
- \r
-\r
- //layer1,style1 layer2,style2\r
- $info=explode(',',$v);\r
-\r
-//1/tdwg_level_1/e24077/2/100000\r
-// admin_level_1,c_america_level_1\r
- //var_dump($info);\r
- $layer=$info[0];\r
- $style=$info[1];\r
-\r
-// 10*admin_level_2,c_america_level_2 \r
- $occurrence = explode('/',$style); \r
-\r
- if (count($occurrence)>1) //more than up (SLD)\r
- {\r
-\r
- //LAYERS=topp:admin_level_1&TRANSPARENT=true&SLD=".URL_SITE."/edit_wp5/geo/layers_sld/admin_level_1.php?params=2/admin_level_1&FORMAT=image%2Fpng&SERVICE=WMS&STYLES=c_america_level_1\r
-\r
- // $up=$occurrence[0]*$up;\r
- //geometry_type/fill_color/stroke/strokestyle/up\r
- $style=((int)$occurrence[0])*$up."/";\r
- //echo $style;\r
- for ( $i = 1; $i < (count($occurrence)); $i++ )\r
- {\r
- $style.=$occurrence[$i]."/";\r
- }\r
- $style = substr($style, 0, -1);\r
- $s="SLD=$URL_SITE/edit_wp5/geo/layers_sld/".$layer.".php?params=".$style;\r
- \r
- } \r
- else\r
- { \r
- if ($up==1)\r
- {\r
- if ($layer=='admin_level_0' || $layer=='admin_level_1' || $layer=='admin_level_2')\r
- {\r
- $s="STYLES=".$layer; \r
- }\r
- else\r
- {\r
- $s="STYLES=".$occurrence[0]; \r
- }\r
- }\r
- else \r
- {\r
- if ($layer=='admin_level_0' || $layer=='admin_level_1' || $layer=='admin_level_2')\r
- {\r
- $s="SLD=$URL_SITE/edit_wp5/geo/layers_sld/".$layer.".php?params=".$up."/".$style; \r
- }\r
-\r
- else\r
- {\r
- // $s="SLD=$URL_SITE/edit_wp5/geo/layers_sld/utm_world.php?params=".$up."/".$layer; \r
-\r
-\r
- if ($layer=='utm250000sqkm_earth' || $layer=='utm1e6sqkm_earth' || $layer=='utm250000sqkm_earth' || $layer=='utm_world')\r
- {\r
- $s="SLD=$URL_SITE/edit_wp5/geo/layers_sld/utm_world.php?params=".$up."/".$layer; \r
-\r
- }\r
- else\r
- {\r
- $s="SLD=$URL_SITE/edit_wp5/geo/layers_sld/".$layer.".php?params=".$up."/".$layer;\r
- }\r
-\r
- }\r
-\r
- }\r
- }\r
- \r
-\r
- $u['layers']['layer'][]=$layer; \r
- $u['layers']['layer']['position'][]=$position; \r
- $u['layers']['style'][]=$style;\r
-\r
- if ($layer=='admin_level_0' || $layer=='admin_level_1' || $layer=='admin_level_2')\r
- {\r
- $url=$URL_GEOSERVER."?LAYERS=topp:".$style."&TRANSPARENT=true&";\r
- $url.=$s."&FORMAT=image%2Fpng&SERVICE=WMS";\r
- }\r
- else\r
- {\r
- $url=$URL_GEOSERVER."?LAYERS=topp:".$layer."&TRANSPARENT=true&";\r
- $url.=$s."&FORMAT=image%2Fpng&SERVICE=WMS";\r
- \r
- }\r
- $url.="&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=".$srs."&BBOX=".$bbox."&WIDTH=".$width."&HEIGHT=".$height; \r
-\r
- $u['layers']['url'][]=$url; \r
-\r
- \r
- }\r
-\r
-}\r
-\r
-\r
-\r
-\r
-\r
-$u2['layers']['url'][]='new LAYERING';\r
-$result = $u+$u2;\r
-\r
-sort($u['layers']['layer']['position']);\r
-$count=count($u['layers']['url']);\r
-\r
-\r
-function to_grey($file,$new_f)\r
-{\r
-global $dpi,$DIR_PLATFORM;\r
- $c="convert '$file' -colorspace Gray '$file'"; \r
- shell_exec($c);\r
- \r
- $c="convert -density $dpi".x."$dpi -units PixelsPerInch '$file' '$file'";\r
-\r
- shell_exec($c);\r
-$URL_SITE="http://edit.br.fgov.be";\r
- echo $URL_SITE."/edit_wp5/geo/images/edit_images.php?format=$new_f&file=".$file;\r
-$DIR_PLATFORM="/var/www";\r
- $img_dir = $DIR_PLATFORM."/edit_wp5/geo/images/download";\r
- $e = dir($img_dir);\r
- $time=time();\r
- while($entry = $e->read()) { \r
- if ($entry!= "." && $entry!= "..") { \r
-\r
- $f_last_modified = filemtime($img_dir."/".$entry);\r
-\r
- if ($time-$f_last_modified >400)\r
- {\r
- unlink($img_dir."/".$entry);\r
- } \r
-\r
- } \r
- } \r
- $e->close();\r
- \r
-}\r
-\r
-function convert_tif ($image)\r
-{\r
- $bits=$_GET['bits'];\r
- $cmyk=$_GET['cmyk'];\r
- global $path,$format,$dpi;\r
-\r
- $t_file= $path.'/'.(rand()%3000).'.tif';\r
-\r
- $c2="convert -compress lzw '$image' '$t_file'";\r
- shell_exec($c2);\r
- \r
-\r
- \r
- if ($format=='tif/gray')\r
- {\r
- $new_f='tif';\r
- to_grey($t_file,$new_f); \r
- \r
- }\r
- \r
- \r
- if ($bits=="8bit")\r
- {\r
- $c="convert -depth 8 '$t_file' '$t_file' ";\r
- \r
- shell_exec($c); \r
- }\r
- if ($cmyk=="cmyk")\r
- {\r
- // $r3= (rand()%3000).'.tif';\r
- $c3="convert '$t_file' -colorspace CMYK '$t_file'";\r
- // echo $c3;\r
- shell_exec($c3);\r
- \r
- }\r
-$c="convert -density $dpi".x."$dpi -units PixelsPerInch '$t_file' '$t_file'";\r
-\r
-shell_exec($c);\r
- \r
-echo URL_SITE."/edit_wp5/geo/images/edit_images.php?format=tif&file=$t_file";\r
- $img_dir = DIR_PLATFORM."/geo/images/download";\r
- $e = dir($img_dir);\r
- $time=time();\r
- while($entry = $e->read()) { \r
- if ($entry!= "." && $entry!= "..") { \r
-\r
- $f_last_modified = filemtime($img_dir."/".$entry);\r
-\r
- if ($time-$f_last_modified >400)\r
- {\r
- unlink($img_dir."/".$entry);\r
- } \r
-\r
- } \r
- } \r
- $e->close();\r
-\r
-} \r
-\r
-function print_file ($r)\r
-{\r
-global $format,$path,$dpi;\r
-if ($format=='tif' || $format=='tif/gray')\r
- {\r
- // global $r2;\r
- //echo "FIFFF";\r
- convert_tif($r);\r
- }\r
- \r
- else if ($format=='image/png')\r
- {\r
- $c="convert -density $dpi".x."$dpi -units PixelsPerInch '$r' '$r'";\r
-\r
- shell_exec($c);\r
-\r
- echo URL_SITE."/edit_wp5/geo/images/edit_images.php?format=png&file=$r"; \r
- $img_dir = DIR_PLATFORM."/geo/images/download";\r
- $e = dir($img_dir);\r
- $time=time();\r
- while($entry = $e->read()) { \r
- if ($entry!= "." && $entry!= "..") { \r
-\r
- $f_last_modified = filemtime($img_dir."/".$entry);\r
-\r
- if ($time-$f_last_modified >40)\r
- {
- unlink($img_dir."/".$entry);\r
- } \r
-\r
- } \r
- } \r
- $e->close(); \r
- }\r
- else\r
- {\r
- \r
- if ($format=='image/jpeg' || $format=='jpeg/gray') { $new_f="jpeg"; }\r
- if ($format=='image/gif' || $format=='gif/gray') { $new_f="gif"; }\r
- if ($format=='image/png' || $format=='png/gray') { $new_f="png"; }\r
- \r
- \r
- $f="$path"."/".(rand()%300).".".$new_f;\r
- $final="convert '$r' '$f'";\r
-\r
- shell_exec($final);\r
- \r
- if ($format=='jpeg/gray' || $format=='gif/gray' || $format=='png/gray')\r
- {\r
- // echo "FINAL is".$f;\r
- to_grey($f,$new_f);\r
- }\r
- else\r
- {\r
- if ($format=='image/jpeg60')\r
- {\r
- \r
- $c="convert -quality 60% $f $f";\r
- shell_exec($c);\r
- \r
- }\r
- if ($format=='image/jpeg40')\r
- {\r
- $c="convert -quality 40% $f $f";\r
- shell_exec($c);\r
- }\r
- if ($format=='image/jpeg20')\r
- {\r
- $c="convert -quality 20% $f $f";\r
-\r
- shell_exec($c);\r
- }\r
- $c="convert -density $dpi".x."$dpi -units PixelsPerInch '$f' '$f'";\r
-\r
- shell_exec($c);\r
-\r
- echo URL_SITE."/edit_wp5/geo/images/edit_images.php?format=$new_f&file=$f";\r
- \r
- \r
- $img_dir = DIR_PLATFORM."/geo/images/download";\r
- $e = dir($img_dir);\r
- $time=time();\r
- while($entry = $e->read()) { \r
- if ($entry!= "." && $entry!= "..") { \r
-\r
- $f_last_modified = filemtime($img_dir."/".$entry);\r
-\r
- if ($time-$f_last_modified >40)\r
- {\r
- unlink($img_dir."/".$entry);\r
- } \r
-\r
- } \r
- } \r
- $e->close(); \r
- }\r
- }\r
-\r
-}\r
-function add_details($r)\r
-{\r
-global $width,$height,$path,$bbox,$up,$srs;\r
-\r
-if (isset($_GET['analysis_layer']))\r
-{\r
- $url=URL_GEOSERVER."?bbox=".$bbox."&Format=image/png&request=GetMap&version=1.1.1&layers=".$_GET['analysis_layer']."&width=".$width."&height=".$height."&srs=".$srs."&TRANSPARENT=true";\r
- $url.="&SLD=".$_GET['analysis_sld'];\r
- $c="composite '$url' '$r' '$r'";\r
- shell_exec($c);\r
-}\r
-if ($_GET['serialized_sld'])\r
-{\r
-$url=URL_GEOSERVER."?bbox=".$bbox."&Format=image/png&request=GetMap&version=1.1.1&layers=serialized_pols&width=".$width."&height=".$height."&srs=".$srs."&TRANSPARENT=true";\r
-$url.="&SLD=".$_GET['serialized_sld'];\r
-$c="composite '$url' '$r' '$r'";\r
-shell_exec($c);\r
-}\r
-\r
-\r
- if ($_GET['windrose'])\r
-{\r
-$windrose=$_GET['windrose'];\r
- $windrose_height=round($_GET['height']/3);\r
- $windrose_width=round($_GET['width']/4);\r
- $windrose_wh=$windrose_height."x".$windrose_width;\r
-$r2="windroses/".(rand()%300).".png";\r
-$xy="convert -resize '$windrose_wh' 'windroses/$windrose' '$r2'";\r
-\r
-shell_exec($xy);\r
-$c4="composite -gravity NorthEast '$r2' '$r' '$r'";\r
-shell_exec($c4);\r
-unlink($r2);\r
-//$c4="convert -pointsize 13 -box grey -font Arial.ttf -annotate 0x0+10+30 '$escala' '$r' '$r'"; \r
-}\r
-if ($_GET['scalebar'])\r
-{\r
-$scalebar=$_GET['scalebar'];\r
-$percent=($up*100)."%";\r
-$scalebar2='resized_legend.png';\r
-\r
-$p="convert -resize '$percent' 'scalebars/$scalebar' 'scalebars/$scalebar2'";\r
-\r
-shell_exec($p);\r
-\r
-\r
-$c4="composite -gravity SouthWest 'scalebars/$scalebar2' '$r' '$r'"; \r
-\r
-shell_exec($c4);\r
-}\r
-\r
- if ($_GET['grids'])\r
- {\r
- \r
- if ($_GET['screen_w']=='medium2') //MACOS \r
- { \r
-\r
- $g_w=735*$up;\r
- $g_h=375*$up;\r
- $white='white_images/white'.$g_w.'.png';\r
- \r
- $grid_lon_style="grids_lon_".$up;\r
- $grid_lat_style="grids_lat_".$up; \r
- }\r
- if ($_GET['screen_w']=='medium1')\r
- {\r
- $g_w=650*$up;\r
- $g_h=330*$up;\r
- $white='white_images/white'.$g_w.'.png';\r
- $grid_lon_style="grids_lon_m".$up;\r
- $grid_lat_style="grids_lat_m".$up;\r
- } //END SCREEN SIZE\r
- if ($_GET['screen_w']=='big')\r
- {\r
- $g_w=round(950*$up);//?\r
- $g_h=round(480*$up);//?\r
- $white='white_images/white'.$g_w.'.png';\r
-// $s="convert -size ".$g_w."x".$g_h." xc:white '$white'";\r
-\r
- \r
- $grid_lat_style="grids_lat_b".$up;\r
- $grid_lon_style="grids_lon_b".$up;\r
- }\r
-\r
- global $grids;\r
- $grids=$_GET['grids'];\r
- $new_height=($_GET['width']/2)*$up;\r
- $new_width=($_GET['width'])*$up;\r
- $new_wh=round($new_width)."x".round($new_height); \r
-\r
- $w=$_GET['width'];\r
- $h=$_GET['height'];\r
- $r_grid=$path."/grid.png";\r
- $r_grid2=$path."/grid2.png";\r
- $grid_lat=$path."/grid_lat.png";\r
- $grid_lon=$path."/grid_lon.png";\r
- $final=$path."/final.png";\r
-\r
-$grids_lon_url=URL_GEOSERVER."?bbox=".$bbox."&styles=".$grid_lon_style."&Format=image/png&request=GetMap&version=1.1.1&layers=topp:".$grids."_line&width=".$w."&height=".$h."&srs=".$srs."&TRANSPARENT=true";\r
-\r
-\r
-$grids_lat_url=URL_GEOSERVER."?bbox=".$bbox."&styles=".$grid_lat_style."&Format=image/png&request=GetMap&version=1.1.1&layers=topp:".$grids."_line&width=".$w."&height=".$h."&srs=".$srs."&TRANSPARENT=true";\r
-\r
-$grids_url=URL_GEOSERVER."?bbox=".$bbox."&styles=grids&Format=image/png&request=GetMap&version=1.1.1&layers=topp:".$grids."&width=".$width."&height=".$height."&srs=".$srs."&TRANSPARENT=true";\r
-\r
-$c="composite '$r' '$grids_url' '$r'";\r
-\r
-shell_exec($c);\r
-$f="convert -resize ".$w."x".$g_h."\! '$grids_lon_url' '$grid_lon'";\r
-\r
-shell_exec($f);\r
-\r
-\r
-$f="convert -resize ".$g_w."x".$h."\! '$grids_lat_url' '$grid_lat'";\r
-\r
-shell_exec($f);\r
-\r
-$f="composite -gravity center '$grid_lon' '$white' '$r_grid2'";\r
-\r
-shell_exec($f);\r
-\r
-\r
-$c="composite -gravity center '$grid_lat' '$r_grid2' '$r_grid2'";\r
-\r
-shell_exec($c);\r
-\r
-$frame=round($up*(2))."x".round($up*(2))."+".round($up)."+".round($up);\r
-$f="convert '$r' -compose Copy -frame $frame '$r'";\r
-\r
- shell_exec($f);\r
-$c="composite -gravity center '$r' '$r_grid2' '$r'";\r
-//$c="composite '$r_grid2' '$r' '$r'";\r
-\r
-shell_exec($c);\r
-\r
-\r
-print_file($r);\r
-\r
-unlink($r_grid);\r
-unlink($r_grid2);\r
-unlink($grid_lat);unlink($grid_lon);\r
-unlink($final);\r
-\r
-}\r
- else\r
- {\r
- global $white;\r
- $c="composite '$r' '$white' '$r'";\r
-\r
-\r
- shell_exec($c);\r
- \r
-print_file($r); \r
- }\r
-}\r
-\r
-function add_points ($image)\r
-{\r
- global $path, $bbox,$width,$height,$bbox,$user,$srs;\r
- $r=$path."/mapserver.png";\r
-\r
-/*\r
-if ($_GET['ms_layer'])\r
-{\r
-$bbox2=explode(',',$bbox);\r
-$ms_bbox=$bbox2[0]."+".$bbox2[1]."+".$bbox2[2]."+".$bbox2[3];\r
-\r
-$mapserv_url=URL_SITE.'/cgi-bin/mapserv?map=/var/www/synthesys/www/geo/images/mapserver_maps/'.$user.'/'.$user.'.map';\r
-$mapserv_url.='&LAYERS=shoreline&GROUP=mapserver&transparent=TRUE&format=image/png';\r
-$mapserv_url.='&mode=map&map_imagetype=png&imgext='.$ms_bbox.'&mapext='.$ms_bbox.'&map_size='.$width.'+'.$height;\r
-\r
-//$ms=URL_SITE.'/cgi-bin/mapserv?map=/var/www/synthesys/www/geo/images/mapserver_maps/888/888.map&LAYERS=shoreline&GROUP=mapserver&transparent=TRUE&format=image/png&mode=map&map_imagetype=png&imgext=-87.994717+7.842392+-80.304287+11.687607&imgxy=700+350';\r
-//$c="convert '$mapserv_url' $image'";\r
-$c="composite '$mapserv_url' '$image' '$image'";\r
-\r
-shell_exec($c);\r
-}\r
-*/\r
-global $URL_GEOSERVER;\r
-if ($_GET['fourth_sld_paths'])\r
-{\r
- $f_points_url=$URL_GEOSERVER."?LAYERS=user_points&TRANSPARENT=TRUE&";\r
- $f_points_url.="SLD=".$_GET['fourth_sld_paths']."&FORMAT=image%2Fpng&SERVICE=WMS";\r
- $f_points_url.="&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=".$srs."&BBOX=".$bbox."&WIDTH=".$width."&HEIGHT=".$height;\r
-$final="composite '$f_points_url' '$image' '$image'";\r
-\r
-shell_exec($final);\r
-}\r
-\r
-if ($_GET['sp_sld_paths'])\r
-{\r
- $sp_points_url=$URL_GEOSERVER."?LAYERS=user_points&TRANSPARENT=TRUE&";\r
- $sp_points_url.="SLD=".$_GET['sp_sld_paths']."&FORMAT=image%2Fpng&SERVICE=WMS";\r
- $sp_points_url.="&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=".$srs."&BBOX=".$bbox."&WIDTH=".$width."&HEIGHT=".$height;\r
-$final="composite '$sp_points_url' '$image' '$image'";\r
-\r
-shell_exec($final);\r
-}\r
-\r
-if ($_GET['sld_path'])\r
-{\r
- $points_url=$URL_GEOSERVER."?LAYERS=user_points&TRANSPARENT=TRUE&";\r
- $points_url.="SLD=".$_GET['sld_path']."&FORMAT=image%2Fpng&SERVICE=WMS";\r
- $points_url.="&VERSION=1.1.1&REQUEST=GetMap&EXCEPTIONS=application%2Fvnd.ogc.se_inimage&SRS=".$srs."&BBOX=".$bbox."&WIDTH=".$width."&HEIGHT=".$height;\r
-\r
-$final="composite '$points_url' '$image' '$image'";\r
-\r
-shell_exec($final);\r
-}\r
-\r
-add_details($image);\r
-}\r
-\r
-for ($i=0;$i<count($result['layers']['url']);$i++)\r
-{\r
-\r
- $random[$i]=$path."/".(rand()%300).".png";\r
-//echo $result['layers']['url'][$i]." with position ".$result['layers']['layer']['position'][$i]."<br>";\r
-\r
-$this_url=$u['layers']['url'][$i];\r
-\r
-\r
-if ($i==0) //�LTIMA (RASTER)\r
- {\r
- $c="convert '$this_url' '$random[$i]'"; \r
-//echo $c;\r
- shell_exec($c);\r
- if ($count==1)\r
- {\r
- add_points($random[$i]); \r
-\r
- }\r
- // add_points($random[$k]);\r
- }\r
- else\r
- {\r
-\r
- if ($i==$count-1) //PEN�LTIMA!!!\r
- {\r
- // echo "K IS $k and count ..... $count-1";\r
- \r
- $prev=$i-1;\r
-\r
- $c="composite '$this_url' '$random[$prev]' '$random[$i]'";\r
- shell_exec($c);\r
-// echo $c;\r
- add_points($random[$i]);\r
-\r
- }\r
- else\r
- {\r
-\r
-\r
- $prev=$i-1;\r
-\r
- $c2="composite '$random[$prev]' '$this_url' '$random[$i]'";\r
-\r
- shell_exec($c2);\r
- }\r
- \r
- }\r
-\r
-}\r
-\r
-\r
-\r
-?>\r