PHP Classes

PHP Contour Plot: Render contour plots from geographic shape files

Recommend this page to a friend!
  Info   View files Example   Screenshots Screenshots   View files View files (13)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog (1)    
Ratings Unique User Downloads Download Rankings
StarStarStar 44%Total: 342 This week: 1All time: 7,059 This week: 560Up
Version License PHP version Categories
contour-plot 0.10BSD License5PHP 5, Graphics, Geography
Description 

Author

This package can render contour plots from geographic shape files.

It can take shape files for a given region and renders an image with contour lines.

The generate contour plot image is saved to a given directory in PNG format.

Innovation Award
PHP Programming Innovation award winner
May 2015
Winner


Prize: PHP Tools for Visual Studio Personal license
Contour lines are lines that connect points in a map that have the same terrain elevation.

This class render contour line images of a given region of the planet.

Manuel Lemos
Picture of Chi H.
  Performance   Level  
Name: Chi H. <contact>
Classes: 28 packages by
Country: France France
Age: 39
All time rank: 34222 in France France
Week rank: 109 Up5 in France France Up
Innovation award
Innovation award
Nominee: 22x

Winner: 3x

Example

<?php
/***************************************************************
* Copyright notice
*
* (c) 2013-2015 Chi Hoang (info@chihoang.de)
* All rights reserved
*
***************************************************************/
require_once("mercator.php");
require_once(
"contour.php");

define("MAPWIDTH",1000);
define("MAPHEIGHT",1000);
//Alphashape
define("ALPHA",12.0);
//shapefile filter
define("OMEGA",0);
//Experimental shapefile z-value
//define("MINRAND",40);
//define("MAXRAND",60);
//contour plot color steps
define("STEPS",6);
//contour plot interval
define("INTERVAL",0.9);
define("SHAPEFILE","PAShapeFile.txt");
define("DATAFILE","PennsylvaniaLonLatT.txt");
//define("SHAPEFILE","txshape.txt");
//define("DATAFILE","txlonlat.txt");
//define("SHAPEFILE","cashape.txt");
//define("DATAFILE","calonlat.txt");
//define("SHAPEFILE","flshape.txt");
//define("DATAFILE","fllonlat.txt");
//Image path output folder
define("PATH","/tmp/");

if( !
ini_get('safe_mode') )
{
   
ini_set("max_execution_time","10000");
   
ini_set("memory_limit","800M");
}
set_time_limit(10000);

$d=new mercator(MAPWIDTH,MAPHEIGHT);
$d->set=$d->loadfileZ(DATAFILE);
$mean=$d->project($d->set);

$s=new mercator(MAPWIDTH,MAPHEIGHT);
$shape=$s->loadfileZ(SHAPEFILE);
$s->set=$s->repair($shape,-1);
$m=$s->project($shape,-1);

$f=new mercator(MAPWIDTH,MAPHEIGHT);
$arr=$f->loadfileZ(DATAFILE);
if (
OMEGA) {
   
$arr=array_merge($arr,$s->filter($s->proj,OMEGA));
}
$m=$f->project($arr,0,$s->mapLonLeft,$s->mapLatBottom,$s->mapLonRight,$s->mapLatTop);

$plot=new Contourplot();
$res=$plot->main($f->proj,$f->mapWidth,$f->mapHeight,$s->proj,$s->proj,$mean,$d->ZMax,$d->ZMin,ALPHA);
 
$pic=new Image(PATH,$plot);
$pic->create();

?>


Screenshots  
  • Screenshotupdate
  Files folder image Files  
File Role Description
Accessible without login Plain text file calonlat.txt Data example data
Accessible without login Plain text file cashape.txt Data example data
Plain text file contour.php Class Class source
Accessible without login Plain text file example.php Example Example script
Accessible without login Plain text file fllonlat.txt Data example data
Accessible without login Plain text file flshape.txt Data example data
Accessible without login Plain text file hilbert.php Aux. update
Plain text file mercator.php Class Class source
Accessible without login Plain text file PAlonlat.txt Data update
Accessible without login Plain text file PAShapeFile.txt Data Auxiliary data
Accessible without login Plain text file PennsylvaniaLonLatT.txt Data Auxiliary data
Accessible without login Plain text file txlonlat.txt Data example data
Accessible without login Plain text file txshape.txt Data example data

 Version Control Unique User Downloads Download Rankings  
 92%
Total:342
This week:1
All time:7,059
This week:560Up
 User Ratings  
 
 All time
Utility:66%StarStarStarStar
Consistency:58%StarStarStar
Documentation:-
Examples:58%StarStarStar
Tests:-
Videos:-
Overall:44%StarStarStar
Rank:3374