{"action":"created","comment":{"url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/comments/43398950","id":43398950,"diff_hunk":"@@ -42,13 +44,123 @@ geo.layer = function (arg) {\n       m_canvas = null,\n       m_renderer = null,\n       m_initialized = false,\n-      m_rendererName = arg.renderer === undefined ? \"vgl\" : arg.renderer,\n+      m_rendererName = arg.renderer === undefined ? 'vgl' : arg.renderer,\n       m_dataTime = geo.timestamp(),\n       m_updateTime = geo.timestamp(),\n       m_drawTime = geo.timestamp(),\n       m_sticky = arg.sticky === undefined ? true : arg.sticky,\n       m_active = arg.active === undefined ? true : arg.active,\n-      m_attribution = arg.attribution || null;\n+      m_attribution = arg.attribution || null,\n+      m_zIndex;\n+\n+  if (!m_map) {\n+    throw new Error('Layers must be initialized on a map.');\n+  }\n+\n+  ////////////////////////////////////////////////////////////////////////////\n+  /**\n+   * Get or set the z-index of the layer.  The z-index controls the display\n+   * order of the layers in much the same way as the CSS z-index property.\n+   *\n+   * @param {number} [zIndex] The new z-index\n+   * @returns {number|this}\n+   */\n+  ////////////////////////////////////////////////////////////////////////////\n+  this.zIndex = function (zIndex) {\n+    if (zIndex === undefined) {\n+      return m_zIndex;\n+    }\n+    m_zIndex = zIndex;\n+    m_node.css('z-index', m_zIndex);\n+    return m_this;\n+  };\n+\n+  ////////////////////////////////////////////////////////////////////////////\n+  /**\n+   * Bring the layer above the given number of layers.  This will rotate the\n+   * current z-indices for this and the next `n` layers.\n+   *\n+   * @param {number} [n=1] The number of positions to move\n+   * @returns {this}\n+   */\n+  ////////////////////////////////////////////////////////////////////////////\n+  this.moveUp = function (n) {\n+    var order, i, me = null, tmp, sign;\n+\n+    // set the default\n+    if (n === undefined) {\n+      n = 1;\n+    }\n+\n+    // set the sort direction that controls if we are moving up\n+    // or down the z-index\n+    sign = 1;\n+    if (n < 0) {","path":"src/core/layer.js","position":92,"original_position":92,"commit_id":"314c55fe6ab35a0bc5ec0dbd3e2db0040df644ee","original_commit_id":"314c55fe6ab35a0bc5ec0dbd3e2db0040df644ee","user":{"login":"aashish24","id":146527,"avatar_url":"https://avatars.githubusercontent.com/u/146527?v=3","gravatar_id":"","url":"https://api.github.com/users/aashish24","html_url":"https://github.com/aashish24","followers_url":"https://api.github.com/users/aashish24/followers","following_url":"https://api.github.com/users/aashish24/following{/other_user}","gists_url":"https://api.github.com/users/aashish24/gists{/gist_id}","starred_url":"https://api.github.com/users/aashish24/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aashish24/subscriptions","organizations_url":"https://api.github.com/users/aashish24/orgs","repos_url":"https://api.github.com/users/aashish24/repos","events_url":"https://api.github.com/users/aashish24/events{/privacy}","received_events_url":"https://api.github.com/users/aashish24/received_events","type":"User","site_admin":false},"body":"clever","created_at":"2015-10-29T15:22:40Z","updated_at":"2015-10-29T15:22:40Z","html_url":"https://github.com/OpenGeoscience/geojs/pull/451#discussion_r43398950","pull_request_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/451","_links":{"self":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/comments/43398950"},"html":{"href":"https://github.com/OpenGeoscience/geojs/pull/451#discussion_r43398950"},"pull_request":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/451"}}},"pull_request":{"url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/451","id":48362613,"html_url":"https://github.com/OpenGeoscience/geojs/pull/451","diff_url":"https://github.com/OpenGeoscience/geojs/pull/451.diff","patch_url":"https://github.com/OpenGeoscience/geojs/pull/451.patch","issue_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/451","number":451,"state":"open","locked":false,"title":"Add the ability to control the display order of layers","user":{"login":"jbeezley","id":31890,"avatar_url":"https://avatars.githubusercontent.com/u/31890?v=3","gravatar_id":"","url":"https://api.github.com/users/jbeezley","html_url":"https://github.com/jbeezley","followers_url":"https://api.github.com/users/jbeezley/followers","following_url":"https://api.github.com/users/jbeezley/following{/other_user}","gists_url":"https://api.github.com/users/jbeezley/gists{/gist_id}","starred_url":"https://api.github.com/users/jbeezley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jbeezley/subscriptions","organizations_url":"https://api.github.com/users/jbeezley/orgs","repos_url":"https://api.github.com/users/jbeezley/repos","events_url":"https://api.github.com/users/jbeezley/events{/privacy}","received_events_url":"https://api.github.com/users/jbeezley/received_events","type":"User","site_admin":false},"body":"The does the simplest possible thing (changing the `z-index` property).  Leaflet has a similar interface for layer order.","created_at":"2015-10-21T17:32:47Z","updated_at":"2015-10-29T15:22:40Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d23a1dbdc5120137346560dbb58ee6d134ce1f50","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/451/commits","review_comments_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/451/comments","review_comment_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/451/comments","statuses_url":"https://api.github.com/repos/OpenGeoscience/geojs/statuses/314c55fe6ab35a0bc5ec0dbd3e2db0040df644ee","head":{"label":"OpenGeoscience:reorder-layers","ref":"reorder-layers","sha":"314c55fe6ab35a0bc5ec0dbd3e2db0040df644ee","user":{"login":"OpenGeoscience","id":3434706,"avatar_url":"https://avatars.githubusercontent.com/u/3434706?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenGeoscience","html_url":"https://github.com/OpenGeoscience","followers_url":"https://api.github.com/users/OpenGeoscience/followers","following_url":"https://api.github.com/users/OpenGeoscience/following{/other_user}","gists_url":"https://api.github.com/users/OpenGeoscience/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGeoscience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGeoscience/subscriptions","organizations_url":"https://api.github.com/users/OpenGeoscience/orgs","repos_url":"https://api.github.com/users/OpenGeoscience/repos","events_url":"https://api.github.com/users/OpenGeoscience/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGeoscience/received_events","type":"Organization","site_admin":false},"repo":{"id":12960038,"name":"geojs","full_name":"OpenGeoscience/geojs","owner":{"login":"OpenGeoscience","id":3434706,"avatar_url":"https://avatars.githubusercontent.com/u/3434706?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenGeoscience","html_url":"https://github.com/OpenGeoscience","followers_url":"https://api.github.com/users/OpenGeoscience/followers","following_url":"https://api.github.com/users/OpenGeoscience/following{/other_user}","gists_url":"https://api.github.com/users/OpenGeoscience/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGeoscience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGeoscience/subscriptions","organizations_url":"https://api.github.com/users/OpenGeoscience/orgs","repos_url":"https://api.github.com/users/OpenGeoscience/repos","events_url":"https://api.github.com/users/OpenGeoscience/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGeoscience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenGeoscience/geojs","description":"High performance visualization and geospatial analysis library","fork":false,"url":"https://api.github.com/repos/OpenGeoscience/geojs","forks_url":"https://api.github.com/repos/OpenGeoscience/geojs/forks","keys_url":"https://api.github.com/repos/OpenGeoscience/geojs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenGeoscience/geojs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenGeoscience/geojs/teams","hooks_url":"https://api.github.com/repos/OpenGeoscience/geojs/hooks","issue_events_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/events{/number}","events_url":"https://api.github.com/repos/OpenGeoscience/geojs/events","assignees_url":"https://api.github.com/repos/OpenGeoscience/geojs/assignees{/user}","branches_url":"https://api.github.com/repos/OpenGeoscience/geojs/branches{/branch}","tags_url":"https://api.github.com/repos/OpenGeoscience/geojs/tags","blobs_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenGeoscience/geojs/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenGeoscience/geojs/languages","stargazers_url":"https://api.github.com/repos/OpenGeoscience/geojs/stargazers","contributors_url":"https://api.github.com/repos/OpenGeoscience/geojs/contributors","subscribers_url":"https://api.github.com/repos/OpenGeoscience/geojs/subscribers","subscription_url":"https://api.github.com/repos/OpenGeoscience/geojs/subscription","commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenGeoscience/geojs/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenGeoscience/geojs/contents/{+path}","compare_url":"https://api.github.com/repos/OpenGeoscience/geojs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenGeoscience/geojs/merges","archive_url":"https://api.github.com/repos/OpenGeoscience/geojs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenGeoscience/geojs/downloads","issues_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues{/number}","pulls_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenGeoscience/geojs/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenGeoscience/geojs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenGeoscience/geojs/labels{/name}","releases_url":"https://api.github.com/repos/OpenGeoscience/geojs/releases{/id}","created_at":"2013-09-19T21:39:25Z","updated_at":"2015-10-27T19:53:22Z","pushed_at":"2015-10-28T18:15:27Z","git_url":"git://github.com/OpenGeoscience/geojs.git","ssh_url":"git@github.com:OpenGeoscience/geojs.git","clone_url":"https://github.com/OpenGeoscience/geojs.git","svn_url":"https://github.com/OpenGeoscience/geojs","homepage":"","size":21929,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":14,"mirror_url":null,"open_issues_count":76,"forks":14,"open_issues":76,"watchers":33,"default_branch":"master"}},"base":{"label":"OpenGeoscience:master","ref":"master","sha":"aba5df5e5364b5e910133a0f987bbb28d7a6e6f4","user":{"login":"OpenGeoscience","id":3434706,"avatar_url":"https://avatars.githubusercontent.com/u/3434706?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenGeoscience","html_url":"https://github.com/OpenGeoscience","followers_url":"https://api.github.com/users/OpenGeoscience/followers","following_url":"https://api.github.com/users/OpenGeoscience/following{/other_user}","gists_url":"https://api.github.com/users/OpenGeoscience/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGeoscience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGeoscience/subscriptions","organizations_url":"https://api.github.com/users/OpenGeoscience/orgs","repos_url":"https://api.github.com/users/OpenGeoscience/repos","events_url":"https://api.github.com/users/OpenGeoscience/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGeoscience/received_events","type":"Organization","site_admin":false},"repo":{"id":12960038,"name":"geojs","full_name":"OpenGeoscience/geojs","owner":{"login":"OpenGeoscience","id":3434706,"avatar_url":"https://avatars.githubusercontent.com/u/3434706?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenGeoscience","html_url":"https://github.com/OpenGeoscience","followers_url":"https://api.github.com/users/OpenGeoscience/followers","following_url":"https://api.github.com/users/OpenGeoscience/following{/other_user}","gists_url":"https://api.github.com/users/OpenGeoscience/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenGeoscience/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenGeoscience/subscriptions","organizations_url":"https://api.github.com/users/OpenGeoscience/orgs","repos_url":"https://api.github.com/users/OpenGeoscience/repos","events_url":"https://api.github.com/users/OpenGeoscience/events{/privacy}","received_events_url":"https://api.github.com/users/OpenGeoscience/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenGeoscience/geojs","description":"High performance visualization and geospatial analysis library","fork":false,"url":"https://api.github.com/repos/OpenGeoscience/geojs","forks_url":"https://api.github.com/repos/OpenGeoscience/geojs/forks","keys_url":"https://api.github.com/repos/OpenGeoscience/geojs/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenGeoscience/geojs/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenGeoscience/geojs/teams","hooks_url":"https://api.github.com/repos/OpenGeoscience/geojs/hooks","issue_events_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/events{/number}","events_url":"https://api.github.com/repos/OpenGeoscience/geojs/events","assignees_url":"https://api.github.com/repos/OpenGeoscience/geojs/assignees{/user}","branches_url":"https://api.github.com/repos/OpenGeoscience/geojs/branches{/branch}","tags_url":"https://api.github.com/repos/OpenGeoscience/geojs/tags","blobs_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenGeoscience/geojs/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenGeoscience/geojs/languages","stargazers_url":"https://api.github.com/repos/OpenGeoscience/geojs/stargazers","contributors_url":"https://api.github.com/repos/OpenGeoscience/geojs/contributors","subscribers_url":"https://api.github.com/repos/OpenGeoscience/geojs/subscribers","subscription_url":"https://api.github.com/repos/OpenGeoscience/geojs/subscription","commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenGeoscience/geojs/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenGeoscience/geojs/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenGeoscience/geojs/contents/{+path}","compare_url":"https://api.github.com/repos/OpenGeoscience/geojs/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenGeoscience/geojs/merges","archive_url":"https://api.github.com/repos/OpenGeoscience/geojs/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenGeoscience/geojs/downloads","issues_url":"https://api.github.com/repos/OpenGeoscience/geojs/issues{/number}","pulls_url":"https://api.github.com/repos/OpenGeoscience/geojs/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenGeoscience/geojs/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenGeoscience/geojs/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenGeoscience/geojs/labels{/name}","releases_url":"https://api.github.com/repos/OpenGeoscience/geojs/releases{/id}","created_at":"2013-09-19T21:39:25Z","updated_at":"2015-10-27T19:53:22Z","pushed_at":"2015-10-28T18:15:27Z","git_url":"git://github.com/OpenGeoscience/geojs.git","ssh_url":"git@github.com:OpenGeoscience/geojs.git","clone_url":"https://github.com/OpenGeoscience/geojs.git","svn_url":"https://github.com/OpenGeoscience/geojs","homepage":"","size":21929,"stargazers_count":33,"watchers_count":33,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":14,"mirror_url":null,"open_issues_count":76,"forks":14,"open_issues":76,"watchers":33,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/451"},"html":{"href":"https://github.com/OpenGeoscience/geojs/pull/451"},"issue":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/issues/451"},"comments":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/issues/451/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/451/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/pulls/451/commits"},"statuses":{"href":"https://api.github.com/repos/OpenGeoscience/geojs/statuses/314c55fe6ab35a0bc5ec0dbd3e2db0040df644ee"}}}}