Reputation: 53
I'm having trouble drawing a contour from a regular grid.
X Y Value
0 50 5
1 51 5
2 52 6
3 53 6
etc.....
The problem, I think is getting the data array correct to then pass to the function.
I am using the PHP Conrec Contouring Subroutine written by Paul Bourke
http://paulbourke.net/papers/conrec/
http://paulbourke.net/papers/conrec/conrec.php_
http://paulbourke.net/papers/conrec/test.php_
My test arrays are
$x=array(0,1,2,3,4,5,6,7,8,9,10); //Longitude
$y=array(50,51,52,53,54,55,56,57,58,59,60); //Latitude
$v=array(5,5,6,6,8,8,9,9,9,5,6); //Value
$z =count($v); //Number of contours??
The function I need to call is:CONREC_contour($d,$x,$y,$z);
The documentation explains that I need to create $d see below
$d is a 2D jagged array, with X on the first dim and Y on the second. I say jagged as PHP does not support a true native multidimensional array type in the same way as other languages do. Thus, (C, Fortran, etc...) d[i,j] === (PHP) $d[i][j]
I'm struggling to understand and create the $d array correctly.
Can anyone please help me? Thank you
Upvotes: 0
Views: 430
Reputation: 12592
You can look into the example how to create the $d array. If it doesn't help you can try my php implementation of a contourplot @ codeplex.com (https://contourplot.codeplex.com/). It uses some idea from indiemaps AS3 isolines implementation.
Upvotes: 1