Zverik / Nik4

Mapnik to image export
Do What The F*ck You Want To Public License
123 stars 23 forks source link

Add option to specify parameters in stylesheet.xml #6

Closed ustroetz closed 10 years ago

ustroetz commented 10 years ago

I like to run a query inside my stylesheet to get a certain feature from my database. It would be nice if I could specify a parameter (e.g. an ID) that will be used inside the function in the Style-sheet.

Zverik commented 10 years ago

Great idea, I would need that for my stylesheet also, e.g. for specifying a GPX trace location.

Zverik commented 10 years ago

I've added variables in format ${name:default} (or simply ${name} for required variables). To process them, use --vars name1=value1 name2=value2 option, or --vars without keys to use default values. Special characters in values (not default) are xml-screened, so do not enclose variables in CDATA.

Please test this, in case I missed some obvious bug or use-case.

ustroetz commented 10 years ago

Test it and it works wonderful! Thanks a lot Zverik for implementing this so quickly. Btw great tool. Saved me a ton of work :)

ustroetz commented 10 years ago

Zverik, can you please make an account on GITTIP? My boss would like to donate some money to you for building this feature for us so quickly.

Zverik commented 10 years ago

I didn't know about this service :) Just signed up, thanks.