| 1 | |
| 2 | = !MapGuide RFC 159 - UTFGrid support = |
| 3 | |
| 4 | This page contains a change request (RFC) for the !MapGuide Open Source project. |
| 5 | More !MapGuide RFCs can be found on the [wiki:MapGuideRfcs RFCs] page. |
| 6 | |
| 7 | == Status == |
| 8 | |
| 9 | ||RFC Template Version||(1.0)|| |
| 10 | ||Submission Date||6 Jun 2017|| |
| 11 | ||Last Modified||6 Jun 2017|| |
| 12 | ||Author||Jackie Ng|| |
| 13 | ||RFC Status||ready for review|| |
| 14 | ||Implementation Status||Pending|| |
| 15 | ||Proposed Milestone||3.3|| |
| 16 | ||Assigned PSC guide(s)||(when determined)|| |
| 17 | ||'''Voting History'''||(vote date)|| |
| 18 | ||+1|||| |
| 19 | ||+0|||| |
| 20 | ||-0|||| |
| 21 | ||-1|||| |
| 22 | ||no vote|| || |
| 23 | |
| 24 | == Overview == |
| 25 | |
| 26 | This RFC proposes to add support for the rendering and storage/retrieval of UTFGrid tiles |
| 27 | |
| 28 | == Motivation == |
| 29 | |
| 30 | UTFGrid is a compact JSON-based specification for storing rasterized interaction data and nicely complements XYZ map tiles. |
| 31 | |
| 32 | Where XYZ tiles provide the visuals, UTFGrid provides the tooltip interaction data. Combined together, you can have powerful |
| 33 | interactive tiled maps that require no sessions or server roundtrips for tooltip data as they can be queried locally from the UTFGrid tile. |
| 34 | |
| 35 | For a more in-depth overview of UTFGrid see: https://www.mapbox.com/blog/how-interactivity-works-utfgrid/ |
| 36 | |
| 37 | == Proposed Solution == |
| 38 | |
| 39 | This RFC will implement version 1.3 of the UTFGrid specification. |
| 40 | |
| 41 | Add a new API to MgRenderingService for the rendering of UTFGrid tiles. |
| 42 | |
| 43 | {{{ |
| 44 | class MG_MAPGUIDE_API MgRenderingService : public MgService |
| 45 | { |
| 46 | PUBLISHED_API: |
| 47 | ///////////////////////////////////////////////////////////////// |
| 48 | /// \brief |
| 49 | /// Returns the specified UTFGrid tile for the given map. Tile structure is |
| 50 | /// based on the XYZ tiling scheme used by Google Maps, OpenStreetMap, and |
| 51 | /// others |
| 52 | /// |
| 53 | /// \param map |
| 54 | /// Input |
| 55 | /// map object containing current state of map. |
| 56 | /// \param baseMapLayerGroupName |
| 57 | /// Input |
| 58 | /// Specifies the name of the baseMapLayerGroup for which to render the tile. |
| 59 | /// \param x |
| 60 | /// Input |
| 61 | /// Specifies the row index of the tile to return. |
| 62 | /// \param y |
| 63 | /// Input |
| 64 | /// Specifies the column index of the tile to return. |
| 65 | /// \param z |
| 66 | /// Input |
| 67 | /// Specifies the zoom level of the tile to return. |
| 68 | /// \param dpi |
| 69 | /// Input |
| 70 | /// Specifies the dpi of the tile to return. |
| 71 | /// \param tileImageFormat |
| 72 | /// Input |
| 73 | /// Specifies the image format of the tile to return. |
| 74 | /// |
| 75 | /// \return |
| 76 | /// A byte reader containing the rendered UTFGrid tile. |
| 77 | /// |
| 78 | /// \since 3.3 |
| 79 | virtual MgByteReader* RenderTileUTFGrid( |
| 80 | MgMap* map, |
| 81 | CREFSTRING baseMapLayerGroupName, |
| 82 | INT32 x, |
| 83 | INT32 y, |
| 84 | INT32 z, |
| 85 | INT32 dpi) = 0; |
| 86 | }; |
| 87 | }}} |
| 88 | |
| 89 | The server-side implementation of this API taps into a new UTFGrid renderer in the Renderers project. The UTFGrid renderer uses the existing AntiGrain Geometry (AGG) library to render "pixels" of UTF characters. |
| 90 | |
| 91 | To avoid unnecessary reinventing of the wheel, our UTFGrid renderer implementation re-uses MapServer's [implementation of the low-level AGG pixel primitives](https://github.com/mapserver/mapserver/blob/branch-7-0/maputfgrid.h) needed to render UTF character "pixels" |
| 92 | |
| 93 | We will leverage the infrastructure introduced in RFC 140 to add support for UTFGrid tiles. |
| 94 | |
| 95 | Support for UTFGrid tiles is exposed through the new {{{TileFormat}}} of {{{UTFGRID}}} in the existing {{{XYZ}}} tile provider. |
| 96 | |
| 97 | Retrieval of UTFGrid tiles is achieved through the existing {{{GETTILEIMAGE}}} mapagent operation version {{{1.2.0}}}, with the {{{MAPDEFINITION}}} parameter pointing to a Tile Set Definition resource configured: |
| 98 | |
| 99 | * With the {{{XYZ}}} tile provider |
| 100 | * With the {{{TileFormat}}} of {{{UTFGRID}}} |
| 101 | |
| 102 | For this RFC, UTFGrid rendering takes the following into consideration: |
| 103 | |
| 104 | * It only looks at layers in the Tile Set that have a tooltip and/or URL defined in their Layer Definition |
| 105 | * Tooltip and Hyperlink content for features in these matching layers are rendered out as the following properties: |
| 106 | * {{{MG_TOOLTIP}}}: The tooltip content for the feature |
| 107 | * {{{MG_URL}}}: The associated hyperlink for the feature |
| 108 | |
| 109 | Thus, if you have a Tile Set configured with a {{{TileFormat}}} of {{{UTFGRID}}}, but have no layers that have tooltips or hyperlinks defined in their respective Layer Definitions, the UTFGrid tiles rendered and retrieved from such a Tile Set Definition will be blank. |
| 110 | |
| 111 | This implementation resides in the [http://trac.osgeo.org/mapguide/browser/sandbox/jng/utfgrid utfgrid sandbox]. Upon adoption of this RFC, it will be merged into trunk. |
| 112 | |
| 113 | == Implications == |
| 114 | |
| 115 | A Tile Set Definition using the {{{XYZ}}} provider and a {{{TileFormat}}} of {{{UTFGRID}}} can only be used on versions of MapGuide on/since the introduction of this RFC. |
| 116 | |
| 117 | == Test Plan == |
| 118 | |
| 119 | Add unit tests for rendering UTFGrids, compare with image-based XYZ tiles at the same X/Y/Z coordinates for "visual" verification of UTFGrid content. |
| 120 | |
| 121 | == Funding / Resources == |
| 122 | |
| 123 | Community |