This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
map_suite_services_edition_spatial_functions_samples [2016/09/23 11:22] tgwikiupdate [Split Polygon Based On Grid] |
map_suite_services_edition_spatial_functions_samples [2017/03/17 03:07] (current) tgwikiupdate |
||
---|---|---|---|
Line 502: | Line 502: | ||
<div sampleitem> | <div sampleitem> | ||
- | ==== Split Polygon into Grid Based On Area ==== | + | ==== Split Polygon Dynamically into Grids based on the Area ==== |
<div screenshot> | <div screenshot> | ||
- | {{servicesedition:codesamples:Map Suite Services Edition Sample Split Polygon into Grid Based On Area.png?300x180}} | + | {{servicesedition:codesamples:dynamicgrid.png?300x180}} |
</div> | </div> | ||
<div content> | <div content> | ||
<div download_viewsource_buttons> | <div download_viewsource_buttons> | ||
[[Source_Code_ServicesEditionSample_SplitPolygonintoGridBasedOnArea_CS_120321.zip|View Source]] | [[Source_Code_ServicesEditionSample_SplitPolygonintoGridBasedOnArea_CS_120321.zip|View Source]] | ||
- | {{filehistory:ServicesEditionSample_SplitPolygonintoGridBasedOnArea_CS_120321.zip|C# Download}} | + | {{servicesedition:ServicesEditionSample_SplitPolygonintoGridBasedOnArea_CS_120321.zip|C# Download}} |
</div> | </div> | ||
<div sample_otherlinks> | <div sample_otherlinks> | ||
Line 515: | Line 515: | ||
\\ | \\ | ||
[[Map Suite Samples Alternate Languages | Need it in another language?]] | [[Map Suite Samples Alternate Languages | Need it in another language?]] | ||
- | </div>This utility was designed to create a “Dynamic Grid” based on the area of the shape, for example, grids in Russia should be bigger than the grids in France. Compared with the fixed size grid in sample [[http://wiki.thinkgeo.com/wiki/map_suite_services_edition_all_samples#split_polygon_based_on_grid|http://wiki.thinkgeo.com/wiki/map_suite_services_edition_all_samples#split_polygon_based_on_grid]] , it’s more efficient and has a better performance when drawing it. | + | </div>This utility was designed to create a “Dynamic Grid” based on the area of the shape, for example, grids in Russia should be bigger than the grids in France. Compared with the fixed size grid in sample [[http://wiki.thinkgeo.com/wiki/map_suite_services_edition_all_samples#split_polygon_based_on_grid|http://wiki.thinkgeo.com/wiki/map_suite_services_edition_all_samples#split_polygon_based_on_grid]] , it’s more efficient and has better drawing performance. |
\\ \\ **From the [[Map_Suite_Performance_Guide#Grid_Detailed_Polygons|Performance Guide]]:** \\ \\ One way to dramatically increase performance is to grid your polygons, thus getting them into an optimized state for rendering. What we want to do is get the average tile render time to be as low as possible. Typically, the features that take the longest time to draw are high point-count polygon layers. Imagine you are rendering a low-level tile that is essentially blank. Most places are empty space at the lowest level, containing perhaps only a small road segment or something similar. To render this, you typically use the country / region polygon to render the earth tone that is the background of your map. There may also be large polygons as well which, while not in view, will be loaded as the tile being rendered is within their spatial bounding box. In order for that simple tile to draw, it needs to read the large region polygon, which may have hundreds of thousands of points, and draw it. While most or all of the points are clipped at run-time, it still takes time to load the bytes from disk, transform to well-known binary, clip them, etc. In many examples, a simple tile can take 500 milliseconds to draw even though it is essentially blank. This makes every area on the map very heavy and inefficient. \\ \\ To solve this issue, we suggest that you grid and split your polygon Shapefiles specifically for improved drawing speed. In this process we take your original high point-count polygon and split it with a grid, with a size depending on the target scale, so that much of the old polygon's area is made of very simple squares with each being composed of just the square's edges. When your simple tile goes to draw, it finds the simple square, draws that and the whole process avoids loading and drawing the tens of thousands of points. We regularly see rendering times for the layer decrease from 500ms to less than 5ms. | \\ \\ **From the [[Map_Suite_Performance_Guide#Grid_Detailed_Polygons|Performance Guide]]:** \\ \\ One way to dramatically increase performance is to grid your polygons, thus getting them into an optimized state for rendering. What we want to do is get the average tile render time to be as low as possible. Typically, the features that take the longest time to draw are high point-count polygon layers. Imagine you are rendering a low-level tile that is essentially blank. Most places are empty space at the lowest level, containing perhaps only a small road segment or something similar. To render this, you typically use the country / region polygon to render the earth tone that is the background of your map. There may also be large polygons as well which, while not in view, will be loaded as the tile being rendered is within their spatial bounding box. In order for that simple tile to draw, it needs to read the large region polygon, which may have hundreds of thousands of points, and draw it. While most or all of the points are clipped at run-time, it still takes time to load the bytes from disk, transform to well-known binary, clip them, etc. In many examples, a simple tile can take 500 milliseconds to draw even though it is essentially blank. This makes every area on the map very heavy and inefficient. \\ \\ To solve this issue, we suggest that you grid and split your polygon Shapefiles specifically for improved drawing speed. In this process we take your original high point-count polygon and split it with a grid, with a size depending on the target scale, so that much of the old polygon's area is made of very simple squares with each being composed of just the square's edges. When your simple tile goes to draw, it finds the simple square, draws that and the whole process avoids loading and drawing the tens of thousands of points. We regularly see rendering times for the layer decrease from 500ms to less than 5ms. | ||
Line 558: | Line 558: | ||
</div> | </div> | ||
</div> | </div> | ||
- |