Saturday 20 October 2018

coordinate system - OpenLayers 3 / Cesium polygon projection issue


I am using OpenLayers 3 and Cesium (via ol3-cesium).


I have created a few rectangles (using a MultiPolygon) stacked on top of each other. Whereas in OpenLayers the rendering (left) is as expected, the output in Cesium (right) is not.


enter image description here


I understand that a rectangle in one projection will not be a rectangle in the other. However, I would expect the software to appropriately project the rectangle.



In this case, what I was expecting is for the Cesium output not to have any gaps between rectangles. On the other hand, the vertices seem to be in the right coordinates, so these polygons are just following the shortest lines between vertices.


What defines which projection is a polygon based upon, and therefore which projection should apply to it? For these vertices, are the right polygons the left or the right ones?


And moreover, how do I get Cesium / ol3-cesium to render the polygons covering the same area as the equivalent polygons in the 2D map?


JSFiddle: https://jsfiddle.net/adlerhn/o1j1fv9x/4/



Answer




What defines which projection is a polygon based upon, and therefore which projection should apply to it? For these vertices, are the right polygons the left or the right ones?



That depends on what purpose the polygons are going to used for.


If their areas matter, then you should build them in an equal area projection like Albers. If 90 degree angles matter, then a conformal projection like Lambert conformal conic or transverse Mercator would work.



Regardless, if you're going to be projecting linear or polygonal features between different projected and geographic coordinate reference systems (CRS), densify the lines.


Many software packages will not densify lines on-the-fly as part of a reprojection for performance reasons or a desire to not change the original feature too much.


In your case, the polygons on the left were build from latitude-longitude coordinates or possibly in a cylindrical projection where latitude lines are straight lines. To get similar-looking features in Cesium, you'll have to densify the features first.


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...