PHP Classes

PHP Contour Plot: Render contour plots from geographic shape files

Recommend this page to a friend!
  Info   Example   Screenshots   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 44%Total: 343 All time: 7,058 This week: 129Up
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: 33922 in France France
Week rank: 197 Up10 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 (1)  
  • Screenshotupdate
  Files folder image Files (14)  
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

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads Download Rankings  
 92%
Total:343
This week:0
All time:7,058
This week:129Up
 User Ratings  
 
 All time
Utility:66%StarStarStarStar
Consistency:58%StarStarStar
Documentation:-
Examples:58%StarStarStar
Tests:-
Videos:-
Overall:44%StarStarStar
Rank:3430