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/05/19 21:31] mwolffer [Splitting a polygon with a line] |
map_suite_services_edition_spatial_functions_samples [2017/03/17 03:07] (current) tgwikiupdate |
||
---|---|---|---|
Line 496: | Line 496: | ||
</div> | </div> | ||
This utility was designed to grid high point-count polygons to aid in faster rendering. It is one of the utilities used in the [[Map_Suite_Performance_Guide#Grid_Detailed_Polygons|Performance Guide]] section of the wiki and is also featured in a [[http://download.thinkgeo.com/Videos/Wiki/IncreasingPolygonPerformance.wmv|performance learning video]]. \\ \\ **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. | This utility was designed to grid high point-count polygons to aid in faster rendering. It is one of the utilities used in the [[Map_Suite_Performance_Guide#Grid_Detailed_Polygons|Performance Guide]] section of the wiki and is also featured in a [[http://download.thinkgeo.com/Videos/Wiki/IncreasingPolygonPerformance.wmv|performance learning video]]. \\ \\ **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. | ||
+ | </div> | ||
+ | </div> | ||
+ | |||
+ | ---- | ||
+ | <div sampleitem> | ||
+ | |||
+ | ==== Split Polygon Dynamically into Grids based on the Area ==== | ||
+ | <div screenshot> | ||
+ | {{servicesedition:codesamples:dynamicgrid.png?300x180}} | ||
+ | </div> | ||
+ | <div content> | ||
+ | <div download_viewsource_buttons> | ||
+ | [[Source_Code_ServicesEditionSample_SplitPolygonintoGridBasedOnArea_CS_120321.zip|View Source]] | ||
+ | {{servicesedition:ServicesEditionSample_SplitPolygonintoGridBasedOnArea_CS_120321.zip|C# Download}} | ||
+ | </div> | ||
+ | <div sample_otherlinks> | ||
+ | [[Map Suite Samples Applies To|Applies To: Desktop \ Web \ Silverlight \ Services \ Wpf ]] | ||
+ | \\ | ||
+ | [[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 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. | ||
</div> | </div> | ||
</div> | </div> | ||
Line 520: | Line 542: | ||
---- | ---- | ||
<div sampleitem> | <div sampleitem> | ||
- | ==== Splitting a polygon with a line ==== | + | ==== Splitting Polygons with a Line ==== |
<div screenshot> | <div screenshot> | ||
{{servicesedition:codesamples:split.jpg?300x180}} | {{servicesedition:codesamples:split.jpg?300x180}} | ||
Line 536: | Line 558: | ||
</div> | </div> | ||
</div> | </div> | ||
- |