Skip to content

Commit 0e998da

Browse files
committed
Mode standalone: rename resulting file to ID.py, set executable
1 parent eb300b9 commit 0e998da

2 files changed

Lines changed: 6 additions & 4 deletions

File tree

doc/API.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ style_elements_z_index | float[] | z-index for each style element.
2929
Notes:
3030
* `!bbox!` and `!scale_denominator!` will be replaced by Mapnik by the current bounding box resp. scale denominator. See [zoom-to-scale.txt](https://trac.openstreetmap.org/browser/subversion/applications/rendering/mapnik/zoom-to-scale.txt) for valid values.
3131

32-
### Mode 'standalone': file pgmapcss_{style_id}.py
33-
When compiling in 'standalone' mode, a file pgmapcss_{style_id}.py will be created, which can be used either from command line or as CGI script. In any case it will produce GeoJSON output. See below for details.
32+
### Mode 'standalone': file {style_id}.py
33+
When compiling in 'standalone' mode, a file {style_id}.py will be created, which can be used either from command line or as CGI script. In any case it will produce GeoJSON output. See below for details.
3434

3535
#### command line
3636
```
37-
usage: pgmapcss_{style_id}.py [-h] [-b BOUNDS] [-s SCALE]
37+
usage: {style_id}.py [-h] [-b BOUNDS] [-s SCALE]
3838
[-P PARAMETERS [PARAMETERS ...]] [--lang LANG]
3939
4040
Executes the compiled map style and prints resulting objects.

pgmapcss/main.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,9 @@ def main():
223223
pgmapcss.db.install(style_id, style, conn)
224224
pgmapcss.renderer.process_renderer(style_id, args, stat, conn)
225225
elif stat['mode'] == 'standalone':
226-
open('pgmapcss_' + style_id + '.py', 'w').write(style['function_match'])
226+
open(style_id + '.py', 'w').write(style['function_match'])
227+
os.chmod(style_id + '.py', 0o755)
228+
print('Created executable {}.py'.format(style_id))
227229

228230
pgmapcss.icons.process_icons(style_id, args, stat, conn)
229231
pgmapcss.symbols.process_symbols(style_id, args, stat, conn)

0 commit comments

Comments
 (0)