2.0_beta sync to rsa
[framework/web/web-ui-fw.git] / libs / js / jquery-geo-1.0a4 / docs / geo / bbox.html
1 <!doctype html>  
2
3 <html lang="en" class="no-js">
4 <head>
5   <meta charset="utf-8">
6
7   <title>bbox | $.geo</title>
8   <meta name="description" content="jQuery Geo bbox method">
9   <meta name="author" content="Ryan Westphal">
10
11   <meta name="viewport" content="width=device-width, initial-scale=1.0">
12
13   <link rel="stylesheet" href="../css/style.css?v=2">
14   <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
15 </head>
16
17 <body>
18
19   <div id="bbox" data-role="page">
20     <div data-role="header" data-theme="b">
21       <h1>bbox</h1>
22     </div>
23     
24     <div data-role="content">
25       <table>
26         <tr>
27           <th>return type</th>
28           <td>Array ( <a href="http://geojson.org/geojson-spec.html#bounding-boxes" rel="external">GeoJSON bounding box</a> )</td>
29         </tr>
30         <tr>
31           <th>syntax</th>
32           <td>$.geo.bbox( Object shape ( <a href="http://geojson.org/geojson-spec.html" rel="external">GeoJSON object</a> ) )</td>
33         </tr>
34         <tr>
35           <th>usage</th>
36           <td><pre><code>var bbox = $.geo.bbox( {
37   type: &quot;LineString&quot;, coordinates: [
38     [ -71, 40 ], [ -70.5, 41 ]
39   ]
40 } )</code></pre></td>
41         </tr>
42       </table>
43       <p>The bbox method calculates the smallest box that will contain all the positions in the passed-in shape. The shape can be any GeoJSON geometry object from Point to GeometryCollection.</p>
44       <p>The GeoJSON spec allows for each geometry type to have a bbox property. The $.geo.bbox method will honor that property and assume it is accurate. It will return the value of that property before attempting to calculate the bbox itself. If you wish to force $.geo.bbox to calculate the bbox, you will have to manually delete the bbox property from the geometry object.</p>
45       <pre><code>var shape = {
46   type: &quot;LineString&quot;, coordinates: [
47     [ -71, 40 ], [ -70.5, 41 ]
48   ],
49   bbox: [ -71, 40, -70.5, 41 ]
50 };
51 var bboxFromProperty = $.geo.bbox(shape);
52 delete shape.bbox;
53 var calculatedBbox = $.geo.bbox(shape);
54 </code></pre>
55       <p>If the argument is not a basic GeoJSON geometry object, this function returns undefined.</p>
56       <!--<p>Due to the liberties taken by web mercator to display a round Earth on a single 
57         flat plane, when working in geodetic (lon/lat) coordinates, the result of the 
58         $.geo.bbox function may not be exactly what you expect based on your input 
59         geodetic geometry.</p>-->
60       <p>This function is similar to Geometry.getEnvelope in JTS.</p>
61      </div>
62   </div> <!-- end of #container -->
63
64   <script src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
65   <script src="http://code.jquerygeo.com/jquery.geo-1.0a4.min.js"></script>
66   <script src="../js/script.js"></script>
67   <script src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
68 </body>
69 </html>
70