{"id":1450,"date":"2015-10-16T20:49:37","date_gmt":"2015-10-16T20:49:37","guid":{"rendered":"http:\/\/www.phpmind.com\/blog\/?p=1450"},"modified":"2015-10-16T20:49:37","modified_gmt":"2015-10-16T20:49:37","slug":"cesiumjs-how-to-add-namedescription-in-the-center-of-polygon","status":"publish","type":"post","link":"https:\/\/www.phpmind.com\/blog\/2015\/10\/cesiumjs-how-to-add-namedescription-in-the-center-of-polygon\/","title":{"rendered":"Cesiumjs How to add name\/description in the center of polygon"},"content":{"rendered":"<p><a href=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/10\/phpmind-cesiumjs-show-name.png\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/10\/phpmind-cesiumjs-show-name.png\" alt=\"phpmind-cesiumjs-show-name\" width=\"440\" height=\"384\" class=\"aligncenter size-full wp-image-1451\" srcset=\"https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/10\/phpmind-cesiumjs-show-name.png 440w, https:\/\/www.phpmind.com\/blog\/wp-content\/uploads\/2015\/10\/phpmind-cesiumjs-show-name-300x262.png 300w\" sizes=\"auto, (max-width: 440px) 100vw, 440px\" \/><\/a><\/p>\n<pre>\r\nvar viewer = new Cesium.Viewer('cesiumContainer');\r\nvar polygon = viewer.entities.add({\r\n    name : 'Polygon',\r\n    polygon : {\r\n        hierarchy : Cesium.Cartesian3.fromDegreesArray([-115.0, 38.0,\r\n                                                        -115.0, 32.0,\r\n                                                        -105.0, 32.0,\r\n                                                        -105.0, 37.0]),\r\n        material : Cesium.Color.RED\r\n    }\r\n});\r\n\r\n\r\nvar label = viewer.entities.add({\r\n    label: {\r\n        text: polygon.name,\r\n        verticalOrigin: Cesium.VerticalOrigin.BOTTOM,\r\n        horizontalOrigin: Cesium.HorizontalOrigin.CENTER,\r\n        eyeOffset: new Cesium.Cartesian3(0,0,-200)\r\n    },\r\n    position: Cesium.Cartesian3.fromDegrees(-110, 35)\r\n});\r\n\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>var viewer = new Cesium.Viewer(&#8216;cesiumContainer&#8217;); var polygon = viewer.entities.add({ name : &#8216;Polygon&#8217;, polygon : { hierarchy : Cesium.Cartesian3.fromDegreesArray([-115.0, 38.0, -115.0, 32.0, -105.0, 32.0, -105.0, 37.0]), material : Cesium.Color.RED } }); var label = viewer.entities.add({ label: { text: polygon.name, verticalOrigin: Cesium.VerticalOrigin.BOTTOM, horizontalOrigin: Cesium.HorizontalOrigin.CENTER, eyeOffset: new Cesium.Cartesian3(0,0,-200) }, position: Cesium.Cartesian3.fromDegrees(-110, 35) });<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"footnotes":""},"categories":[53,27],"tags":[],"class_list":["post-1450","post","type-post","status-publish","format-standard","hentry","category-cesiumjs","category-javascript"],"_links":{"self":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/comments?post=1450"}],"version-history":[{"count":1,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1450\/revisions"}],"predecessor-version":[{"id":1452,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/posts\/1450\/revisions\/1452"}],"wp:attachment":[{"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/media?parent=1450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/categories?post=1450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.phpmind.com\/blog\/wp-json\/wp\/v2\/tags?post=1450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}