| 1 | [[PageOutline]] |
| 2 | |
| 3 | This page is part of the [wiki:Future MapGuide Future] section, where ideas are proposed and refined before being turned into RFCs (or discarded). Visit the [wiki:Future] page to view more! |
| 4 | |
| 5 | = Overview = |
| 6 | |
| 7 | The `mg-desktop` sub-project of MapGuide has demonstrated the ability to take the functionality of MapGuide (data access, rendering, etc) and wrap it up in a portable, server-less library for use in desktop application or server-tier-less web applications. |
| 8 | |
| 9 | For an application that wants lightweight map rendering capabilities for a given FDO-accessible data source, `mg-desktop` is still a bit too heavy-weight and (more importantly) windows-specific. |
| 10 | |
| 11 | This page floats the idea of a portable, lower-level command-line tool that does only one thing: Render maps against FDO-accessible data sources. |
| 12 | |
| 13 | = Map Render Tool = |
| 14 | |
| 15 | If anyone remembers the ancient MapGuide 6.5 (and older) component called LiteView, the Map Render Tool is basically a command-line version of that concept. |
| 16 | |
| 17 | Or an alternative way of thinking about this tool is that it is a a command-line version of the stateless `GETMAPIMAGE` mapagent operation. |
| 18 | |
| 19 | The tool itself does not utilize the MapGuide API services platform. Instead, in line with its lightweight goal, it will use only the MG rendering/stylization libraries directly with FDO for data access. The Foundation/Geometry parts we will most likely leverage for coordinate system and geometry operations functionality. |
| 20 | |
| 21 | = Usage patterns = |
| 22 | |
| 23 | The basic usage patterns of this tool is as follows: |
| 24 | |
| 25 | 1. Rendering map images |
| 26 | |
| 27 | ``` |
| 28 | MgMapRender.exe render --map path/to/mapdef.xml --width image_width --height image_height --dpi dpi --format PNG |
| 29 | [--extent minx,miny,maxx,maxy] or [--view_center x,y --scale scale] |
| 30 | [--showlayers layer1,layer2,...,layerN] |
| 31 | [--showgroups group1,group2,...,groupN] |
| 32 | [--hidelayers layer1,layer2,...,layerN] |
| 33 | [--hidegroups group1,group2,...,groupN] |
| 34 | ``` |
| 35 | |
| 36 | The parameters here basically line up with the `GETMAPIMAGE` mapagent operation |
| 37 | |
| 38 | Running the tool will render an image of the map with the given definition and view parameters in the requested format and outputs the image content to standard output. |
| 39 | |
| 40 | By sending the image content to standard output, the tool assumes a HTTP-like language neutral embedding API. Any programming environment/framework that supports spawning processes and reading its stdout stream can implement a basic map viewer. |
| 41 | |
| 42 | 2. Querying features ("clicking" a point) |
| 43 | |
| 44 | ``` |
| 45 | MgMapRender.exe query --map path/to/mapdef.xml --width image_width --height image_height --dpi dpi |
| 46 | [--extent minx,miny,maxx,maxy] or [--view_center x,y --scale scale] |
| 47 | [--query_point x,y] or [--query_geom geometry_wkt] |
| 48 | ``` |
| 49 | |
| 50 | The parameters here basically line up with the `QUERYMAPFEATURES` mapagent operation |
| 51 | |
| 52 | = Custom Map Definition XML schema = |
| 53 | |
| 54 | Unlike the regular Map Definiton XML schema, the XML schema of the mapdef is substantially different. The reason for this is that this tool does not have a notion of a "resource service" so any layers on this map need to inline their Layer Definition and Feature Source definitions in the same document. |
| 55 | |
| 56 | ``` |
| 57 | XML schema TBD |
| 58 | ``` |
| 59 | |
| 60 | = "Compiling" map definition XML = |
| 61 | |
| 62 | Having to point to an XML document every time to render a map image could introduce understandable performance overhead from needing to parse and load this XML on every invocation of the tool. |
| 63 | |
| 64 | To avoid this, our tool could support "compiling" this XML map definition into a more compact binary form analogous to existing `MgMap` serialized state in current MapGuide proper that you would reference via a `SESSION` and `MAPNAME` pair when doing any map rendering or query operations. |
| 65 | |
| 66 | Then instead of pointing to a mapdef XML document, one could point to this binary blob instead |