|
| 1 | +*Read in another language: [Русский](readme.md)* |
| 2 | + |
| 3 | +--- |
| 4 | + |
| 5 | +**Grid** - a local HTTP server for generating vector tiles (in KML and GeoJSON formats) with various geographic/coordinate grids. |
| 6 | + |
| 7 | +The server includes 3 built-in grids: |
| 8 | +- Geographic WGS 84 |
| 9 | +- Gauss-Krüger / Pulkovo-1942 coordinate grid (zones of 6 degrees) |
| 10 | +- UTM / WGS 84 coordinate grid (zones of 6 degrees) |
| 11 | + |
| 12 | +Additionally, it is possible to add arbitrary grids via the grid.ini file. For example: |
| 13 | + |
| 14 | +``` |
| 15 | +[utm-zone-31n] |
| 16 | +GeogCS=+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs |
| 17 | +ProjCS=+proj=utm +zone=31 +datum=WGS84 +units=m +no_defs +type=crs |
| 18 | +DrawPoints=0 |
| 19 | +DrawLines=1 |
| 20 | +``` |
| 21 | +The section name is used to identify the grid in the URL request. |
| 22 | + |
| 23 | +Parameters `GeogCS` (mandatory) and `ProjCS` - projection initialization string for the proj4 library. If the `ProjCS` parameter is missing, the grid is considered geographic. If both parameters are present, the grid is considered coordinate. |
| 24 | + |
| 25 | +Parameters `DrawPoints`/`DrawLines` (optional) enable or disable the recording of points/lines in the output file. |
| 26 | + |
| 27 | +URL request structure: `http://localhost:8888/{grid-id}/{step}/{z}/{x}/{y}.ext` |
| 28 | +- `{grid-id}` - grid ID (section name from grid.ini or *wgs84*, *gauss-kruger*, *utm* - for built-in grids); |
| 29 | +- `{step}` - grid step: in degrees for geographic grids; in kilometers for coordinate grids. A period is used as the decimal separator. For degree grids, you can specify 0 for automatic step; |
| 30 | +- `{z}`, `{x}`, `{y}` - tile coordinates as for OpenStreetMap (EPSG:3857); |
| 31 | +- `.ext` - tile format (supported: *.kml*, *.json*) |
| 32 | + |
| 33 | + |
| 34 | +--- |
| 35 | + |
| 36 | +**Usage** |
| 37 | +- Extract the archive into the SASPlanet folder (without replacing proj.dll); |
| 38 | +- Run grid.exe, then run SAS; |
| 39 | +- In the list of layers in SAS, select one of the available grids in the Grid submenu. |
| 40 | + |
| 41 | +To automate the server startup before launching SAS, you can install [AutoHotKey v1.1](https://www.autohotkey.com/) and run the bundle via the script *run-sas-and-grid.ahk*: |
| 42 | +``` |
| 43 | +run, grid.exe,,hide,ppid |
| 44 | +runwait, SASPlanet.exe |
| 45 | +process,close,%ppid% |
| 46 | +``` |
| 47 | +The script runs grid.exe, then launches SASPlanet.exe, waits in the tray until SAS closes, and terminates the grid.exe process. In this case, grid.exe starts in hidden mode, so no windows appear in front of you. But note that in this hidden mode, you may not see important error messages from the server. Therefore, the first server startup is recommended to be done manually. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +**Building** |
| 52 | + |
| 53 | +To compile the server from source code, you will need: |
| 54 | +- Delphi (the newer, the better) / FreePascal (v3.2.3 or newer); |
| 55 | +- [mORMot v2](https://github.com/synopse/mORMot2) |
0 commit comments