| 1 |
<!-- $Id: array.html,v 1.5 2008/11/06 20:10:44 bdragon Exp $ --> |
<!-- $Id: array.html,v 1.6 2009/02/03 17:17:37 bdragon Exp $ --> |
| 2 |
|
|
| 3 |
<p>A GMap array is used to define and render a map inside PHP code. This is useful |
<p>A GMap array is used to define and render a map inside PHP code. This is useful |
| 4 |
for things like creating a map based on a database query, or doing things that you |
for things like creating a map based on a database query, or doing things that you |
| 396 |
<pre> |
<pre> |
| 397 |
array( |
array( |
| 398 |
array( |
array( |
| 399 |
|
'type' => 'line', |
| 400 |
|
'points' => array( |
| 401 |
|
array(0.000, 0.000), // First point. |
| 402 |
|
array(0.000, 0.000), // Second point. |
| 403 |
|
array(0.000, 0.000), // Third point. |
| 404 |
|
), |
| 405 |
|
'style' => array("00ff00", 5, 80), |
| 406 |
) |
) |
| 407 |
array( |
array( |
| 408 |
'type' => 'polygon', |
'type' => 'polygon', |
| 426 |
'point2' => array(0.000, 0.000), // One of the vertex coordinates. |
'point2' => array(0.000, 0.000), // One of the vertex coordinates. |
| 427 |
'style' => array(), // Style to use. |
'style' => array(), // Style to use. |
| 428 |
), |
), |
| 429 |
|
array( |
| 430 |
|
'type' => 'encoded_line', |
| 431 |
|
'points' => 'icx~FfigvOt~CsnB~Vo`G~aDqnBp`@chB', // a series of points, encoded |
| 432 |
|
'levels' => 'BBBBB', // zoom level for each point, encoded |
| 433 |
|
'numLevels' => 18, // derived from the encoding algorithm |
| 434 |
|
'zoomFactor' => 2, // derived from the encoding algorithm |
| 435 |
|
'style' => array(), |
| 436 |
|
), |
| 437 |
|
array( |
| 438 |
|
'type' => 'encoded_polygon', |
| 439 |
|
'polylines' => array( |
| 440 |
|
array( |
| 441 |
|
'points' => 's{r~FnwcvO`zB{qHa}Fa`E~aC|rN', |
| 442 |
|
'levels' => 'BBBB', |
| 443 |
|
'numLevels' => 18, |
| 444 |
|
'zoomFactor' => 2, |
| 445 |
|
), |
| 446 |
|
), |
| 447 |
|
'style' => array(), |
| 448 |
|
), |
| 449 |
); |
); |
| 450 |
</pre> |
</pre> |
| 451 |
</dd> |
</dd> |
| 452 |
<dt>Notes:</dt> |
<dt>Notes:</dt> |
| 453 |
<dd></dd> |
<dd><p>For both <strong>encoded_line</strong> and <strong>encoded_polyline</strong>, the 'points', 'levels', 'numLevels', and 'zoomFactor' should be generated using the <em>gmap_polyutil_polyline()</em> function in <em>gmap_polyutil.inc</em>. To use this, pass an array of points into the function:</p> |
| 454 |
|
<pre>$points = array( |
| 455 |
|
array(41.90625, -87.67634), |
| 456 |
|
array(41.91226, -87.65643), |
| 457 |
|
array(41.91021, -87.65059), |
| 458 |
|
array(41.90753, -87.64956), |
| 459 |
|
); |
| 460 |
|
$gmap_encoding = gmap_polyutil_polyline($points); |
| 461 |
|
</pre> |
| 462 |
|
<p>results in:</p> |
| 463 |
|
<pre>Array |
| 464 |
|
( |
| 465 |
|
[points] => ayw~FbhcvOqd@m{BxKoc@vOmE |
| 466 |
|
[levels] => PGFP |
| 467 |
|
[numLevels] => 18 |
| 468 |
|
[zoomFactor] => 2 |
| 469 |
|
) |
| 470 |
|
</pre></dd> |
| 471 |
</dl> |
</dl> |
| 472 |
</li> |
</li> |
| 473 |
|
|