4 <title>append to service test</title>
5 <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
6 <meta name="description" content="An example of append to service">
7 <meta name="author" content="Ryan Westphal">
8 <link rel="stylesheet" type="text/css" href="css/style.css" />
9 <style type="text/css">
26 <a href="../" class="docLink">< docs</a>
27 <a href="http://jsfiddle.net/ryanttb/==JSFIDDLE==/embedded/" class="fiddleLink"><img src="img/jsfiddle.png" alt="" /> jsFiddle ></a>
29 <h1>append to service</h1>
30 <p>This page is similar to the regular append example but tests appending shapes to a specific service instead of the map itself. The result, however, should look exactly the same.</p>
33 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
34 <script src="http://code.jquerygeo.com/jquery.geo-1.0a4.min.js"></script>
38 var map = $( "#map" ).geomap( {
42 service = map.find( ".osm" );
44 // create a geometry collection having a
45 // Point, LineString and Polygon
47 type: "GeometryCollection",
51 coordinates: [-71, 42]
72 // append the entire collection as a single geometry
73 // do not refresh the service yet
74 service.geomap("append", gcol, { strokeWidth: "8px", color: "#dedede" }, false);
77 // I'm refreshing the service just as an example
78 // since true is the default, this is the same as not passing it
79 // we normally would pass false because there's more append calls below
80 service.geomap("append", gcol.geometries[0], true);
82 // append the LineString
83 // don't refresh the service yet,
84 // this is the correct way when there's more drawing to do
85 service.geomap("append", gcol.geometries[1], false);
87 // append the Polygon with a blue style
88 // refresh will default to true and the service will redraw
89 // even if we passed false to all append calls above
90 service.geomap("append", gcol.geometries[2], { color: "#00d" });