* mp-geo Metapost package with ConTeXt @ 2021-07-14 14:43 Gavin 2021-07-15 15:48 ` Hans Hagen 0 siblings, 1 reply; 26+ messages in thread From: Gavin @ 2021-07-14 14:43 UTC (permalink / raw) To: mailing list for ConTeXt users Hello ConTeXters, I’d like to use the mp-geo Metapost package with ConTeXt to draw simple globes viewed from various directions. The package is here: https://melusine.eu.org/syracuse/poulecl/mp-geo/ It looks like the last update was 2008 and I don’t read French, so I though my chances of getting anything to work were pretty small. However, I was pleasantly surprised that this MWE found the mp-geo package, the necessary Metapost files in the ConTeXt installation, and the data files. \starttext \startMPcode input mp-geo; figure(-10u,-10u,10u,10u); Mercator(3,48,30); fin; end \stopMPcode \stoptext While all of the files were found, it did not produce a globe. Instead I got an error complaining about an invalid character in the data files. This error is repeated for about 20 files (a small fraction of the total). I put the first error and its data file below. All the others are identical with different .dat files. Maybe it’s just an encoding mismatch or a hidden character I can easily delete or replace. On the other hand, maybe I shouldn't even be attempting this? 2008 is a long time ago in ConTeXt time. Feel free to tell me this project is crazy, but if you have an idea how I can make this work, I’d really appreciate it! It looks like a fun package. Thanks! Gavin Error Log: (This error log below is actually from running Metapost directly on just the .mp file with the metapost code above. This error log is slightly more clear in its formatting than the ConTeXt log, but contains the same information.) ! Text line contains an invalid character. <scantokens> ^^@ <to be read again> ; Lecture->...nblec:=scantokens.readfrom.NomFichier; for.w=1upto.nblec:if.proje... Mercator->...((EXPR4));Lecture("Cameriquesud.dat") ;Lecture("Ccaraibes.dat");... l.3 Mercator(3,48,30) ; ? ! An expression can't begin with `;'. <inserted text> 0 <to be read again> ; Lecture->...nblec:=scantokens.readfrom.NomFichier; for.w=1upto.nblec:if.proje... Mercator->...((EXPR4));Lecture("Cameriquesud.dat") ;Lecture("Ccaraibes.dat");... l.3 Mercator(3,48,30) ; Data file Cameriquesud.dat is pretty short: 16 arborescence&"bresil.dat",vert arborescence&"uruguay.dat",jaune arborescence&"paraguay.dat",jaune arborescence&"bolivie1.dat",bleu arborescence&"bolivie2.dat",bleu arborescence&"argentine1.dat",rouge arborescence&"argentine2.dat",rouge arborescence&"chili1.dat",violet arborescence&"chili2.dat",violet arborescence&"guineef.dat",jaune arborescence&"surinam.dat",rouge arborescence&"guyane.dat",orange arborescence&"venezuela.dat",bleu arborescence&"colombie.dat",rouge arborescence&"perou.dat",rose arborescence&"equateur.dat",jaune ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-14 14:43 mp-geo Metapost package with ConTeXt Gavin @ 2021-07-15 15:48 ` Hans Hagen 2021-07-15 16:22 ` Aditya Mahajan 0 siblings, 1 reply; 26+ messages in thread From: Hans Hagen @ 2021-07-15 15:48 UTC (permalink / raw) To: Gavin, mailing list for ConTeXt users On 7/14/2021 4:43 PM, Gavin wrote: > Hello ConTeXters, > > I’d like to use the mp-geo Metapost package with ConTeXt to draw simple globes viewed from various directions. The package is here: > > https://melusine.eu.org/syracuse/poulecl/mp-geo/ > > It looks like the last update was 2008 and I don’t read French, so I though my chances of getting anything to work were pretty small. However, I was pleasantly surprised that this MWE found the mp-geo package, the necessary Metapost files in the ConTeXt installation, and the data files. > > \starttext > \startMPcode > input mp-geo; > figure(-10u,-10u,10u,10u); > Mercator(3,48,30); > fin; > end > \stopMPcode > \stoptext > > While all of the files were found, it did not produce a globe. Instead I got an error complaining about an invalid character in the data files. This error is repeated for about 20 files (a small fraction of the total). I put the first error and its data file below. All the others are identical with different .dat files. > > Maybe it’s just an encoding mismatch or a hidden character I can easily delete or replace. On the other hand, maybe I shouldn't even be attempting this? 2008 is a long time ago in ConTeXt time. Feel free to tell me this project is crazy, but if you have an idea how I can make this work, I’d really appreciate it! It looks like a fun package. Looks interesting (I didn't know about it, also the surface stuff). Anyway, the message relates to scantokens not liking what gets read from a file, quite probably a missing file (I'll make it return a different message but still one needs to be aware of the fact that fiel reading in mp is kind of weird so it really expects a file). That said, there are some issues that you need to sort out: no btex/etex and no TEX command but textext instead. You could ask the authors. There are indeed funny characters in the files but nothing your bilingual local context user group member Alan couldn't help you with (a good reason to visit him. My french is too rusty (even with some french music running in the background right now.) If you can get that code running it makes a nice article. Hans PS. 2008 is not that old, many context commands date from the 90's ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-15 15:48 ` Hans Hagen @ 2021-07-15 16:22 ` Aditya Mahajan 2021-07-15 17:58 ` Hans Hagen 0 siblings, 1 reply; 26+ messages in thread From: Aditya Mahajan @ 2021-07-15 16:22 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: text/plain, Size: 2148 bytes --] On Thu, 15 Jul 2021, Hans Hagen wrote: > On 7/14/2021 4:43 PM, Gavin wrote: > > Hello ConTeXters, > > > > I’d like to use the mp-geo Metapost package with ConTeXt to draw simple > globes viewed from various directions. The package is here: > > > > https://melusine.eu.org/syracuse/poulecl/mp-geo/ > > > > It looks like the last update was 2008 and I don’t read French, so I though > my chances of getting anything to work were pretty small. However, I was > pleasantly surprised that this MWE found the mp-geo package, the necessary > Metapost files in the ConTeXt installation, and the data files. > > > > \starttext > > \startMPcode > > input mp-geo; > > figure(-10u,-10u,10u,10u); > > Mercator(3,48,30); > > fin; > > end > > \stopMPcode > > \stoptext > > > > While all of the files were found, it did not produce a globe. Instead I got > an error complaining about an invalid character in the data files. This error > is repeated for about 20 files (a small fraction of the total). I put the > first error and its data file below. All the others are identical with > different .dat files. > > > > Maybe it’s just an encoding mismatch or a hidden character I can easily > delete or replace. On the other hand, maybe I shouldn't even be attempting > this? 2008 is a long time ago in ConTeXt time. Feel free to tell me this > project is crazy, but if you have an idea how I can make this work, I’d really > appreciate it! It looks like a fun package. > Looks interesting (I didn't know about it, also the surface stuff). > Anyway, the message relates to scantokens not liking what gets read from > a file, quite probably a missing file (I'll make it return a different > message but still one needs to be aware of the fact that fiel reading in > mp is kind of weird so it really expects a file). Actually the data files are fairly simple: no_of_points <list of coordinates> So, it would be much simpler to read and parse it via lua rather than scantokens. Rest of the code simply determines a "view" of what to show. So, it can be a good exercise in lua-MP interface. Aditya [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-15 16:22 ` Aditya Mahajan @ 2021-07-15 17:58 ` Hans Hagen 2021-07-15 20:30 ` Bruce Horrocks ` (2 more replies) 0 siblings, 3 replies; 26+ messages in thread From: Hans Hagen @ 2021-07-15 17:58 UTC (permalink / raw) To: mailing list for ConTeXt users, Aditya Mahajan On 7/15/2021 6:22 PM, Aditya Mahajan wrote: > On Thu, 15 Jul 2021, Hans Hagen wrote: > >> On 7/14/2021 4:43 PM, Gavin wrote: >>> Hello ConTeXters, >>> >>> I’d like to use the mp-geo Metapost package with ConTeXt to draw simple >> globes viewed from various directions. The package is here: >>> >>> https://melusine.eu.org/syracuse/poulecl/mp-geo/ >>> >>> It looks like the last update was 2008 and I don’t read French, so I though >> my chances of getting anything to work were pretty small. However, I was >> pleasantly surprised that this MWE found the mp-geo package, the necessary >> Metapost files in the ConTeXt installation, and the data files. >>> >>> \starttext >>> \startMPcode >>> input mp-geo; >>> figure(-10u,-10u,10u,10u); >>> Mercator(3,48,30); >>> fin; >>> end >>> \stopMPcode >>> \stoptext >>> >>> While all of the files were found, it did not produce a globe. Instead I got >> an error complaining about an invalid character in the data files. This error >> is repeated for about 20 files (a small fraction of the total). I put the >> first error and its data file below. All the others are identical with >> different .dat files. >>> >>> Maybe it’s just an encoding mismatch or a hidden character I can easily >> delete or replace. On the other hand, maybe I shouldn't even be attempting >> this? 2008 is a long time ago in ConTeXt time. Feel free to tell me this >> project is crazy, but if you have an idea how I can make this work, I’d really >> appreciate it! It looks like a fun package. >> Looks interesting (I didn't know about it, also the surface stuff). >> Anyway, the message relates to scantokens not liking what gets read from >> a file, quite probably a missing file (I'll make it return a different >> message but still one needs to be aware of the fact that fiel reading in >> mp is kind of weird so it really expects a file). > > Actually the data files are fairly simple: > > no_of_points > <list of coordinates> > > So, it would be much simpler to read and parse it via lua rather than scantokens. Rest of the code simply determines a "view" of what to show. So, it can be a good exercise in lua-MP interface. I was wondering about that too. I admit that I looked into maps years ago but never could find quality data files. \starttext \startluacode function mp.maptopath(filename) local t = { cycle = true } for x, y in string.gmatch(io.loaddata(filename),"%(([%+%-%d]+),([%+%-%d]+)%)") do t[#t+1] = { tonumber(x), tonumber(y) } end mp.inject.path(t) end \stopluacode \startMPpage draw lua.mp.maptopath("slovenia.dat") ; \stopMPpage \startMPpage draw lua.mp.maptopath("usa1.dat") rotated 90 ; \stopMPpage \startMPpage draw lua.mp.maptopath("usa2.dat") ; \stopMPpage \stoptext way to low quality ... we also want multiple shapes i guess .. i wonder if someone knows where to get good free data (projections are more your turf) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-15 17:58 ` Hans Hagen @ 2021-07-15 20:30 ` Bruce Horrocks 2021-07-16 19:55 ` Hans Hagen 2021-07-16 16:20 ` Gavin [not found] ` <E1B2010C-A435-46AD-BD8E-F4D930827791@me.com> 2 siblings, 1 reply; 26+ messages in thread From: Bruce Horrocks @ 2021-07-15 20:30 UTC (permalink / raw) To: ntg-context On 15 Jul 2021, at 18:58, Hans Hagen <j.hagen@xs4all.nl> wrote: > > I was wondering about that too. I admit that I looked into maps years ago but never could find quality data files. Does this help? <https://www.naturalearthdata.com> — Bruce Horrocks Hampshire, UK ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-15 20:30 ` Bruce Horrocks @ 2021-07-16 19:55 ` Hans Hagen 2021-07-17 9:53 ` Bruce Horrocks 0 siblings, 1 reply; 26+ messages in thread From: Hans Hagen @ 2021-07-16 19:55 UTC (permalink / raw) To: mailing list for ConTeXt users, Bruce Horrocks On 7/15/2021 10:30 PM, Bruce Horrocks wrote: > On 15 Jul 2021, at 18:58, Hans Hagen <j.hagen@xs4all.nl> wrote: >> >> I was wondering about that too. I admit that I looked into maps years ago but never could find quality data files. > > Does this help? > <https://www.naturalearthdata.com> i was halfway writing as reader for that fiel format when i noticed that is is also quite low res so i gave up on that and started playing (extending) with an more interesting alternative that mojca and i wrote years ago at a meeting Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-16 19:55 ` Hans Hagen @ 2021-07-17 9:53 ` Bruce Horrocks 2021-07-17 10:20 ` Henning Hraban Ramm 0 siblings, 1 reply; 26+ messages in thread From: Bruce Horrocks @ 2021-07-17 9:53 UTC (permalink / raw) To: Hans Hagen; +Cc: ntg-context > On 16 Jul 2021, at 20:55, Hans Hagen <j.hagen@xs4all.nl> wrote: > > On 7/15/2021 10:30 PM, Bruce Horrocks wrote: >> On 15 Jul 2021, at 18:58, Hans Hagen <j.hagen@xs4all.nl> wrote: >>> >>> I was wondering about that too. I admit that I looked into maps years ago but never could find quality data files. >> Does this help? >> <https://www.naturalearthdata.com> > i was halfway writing as reader for that fiel format when i noticed that is is also quite low res so i gave up on that and started playing (extending) with an more interesting alternative that mojca and i wrote years ago at a meeting Off the top of my head I'm not aware of any higher resolution sources of global data - what scale were you thinking of? For the UK there are free maps down to street level, either as a single file or API. The API details are here: <https://www.ordnancesurvey.co.uk/business-government/products/maps-api> The license allows free use for apps made available to the public. — Bruce Horrocks Hampshire, UK ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-17 9:53 ` Bruce Horrocks @ 2021-07-17 10:20 ` Henning Hraban Ramm 2021-07-17 10:45 ` Hans Hagen ` (2 more replies) 0 siblings, 3 replies; 26+ messages in thread From: Henning Hraban Ramm @ 2021-07-17 10:20 UTC (permalink / raw) To: mailing list for ConTeXt users > Am 17.07.2021 um 11:53 schrieb Bruce Horrocks <ntg@scorecrow.com>: > > > >> On 16 Jul 2021, at 20:55, Hans Hagen <j.hagen@xs4all.nl> wrote: >> >> On 7/15/2021 10:30 PM, Bruce Horrocks wrote: >>> On 15 Jul 2021, at 18:58, Hans Hagen <j.hagen@xs4all.nl> wrote: >>>> >>>> I was wondering about that too. I admit that I looked into maps years ago but never could find quality data files. >>> Does this help? >>> <https://www.naturalearthdata.com> >> i was halfway writing as reader for that fiel format when i noticed that is is also quite low res so i gave up on that and started playing (extending) with an more interesting alternative that mojca and i wrote years ago at a meeting > > Off the top of my head I'm not aware of any higher resolution sources of global data - what scale were you thinking of? Can you work with OpenStreetMap data? https://planet.openstreetmap.org http://download.geofabrik.de https://download.bbbike.org/osm/ I didn’t find excerpts that only have e.g. country borders or rivers. But with usual XML tools you could extract those. Hraban ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-17 10:20 ` Henning Hraban Ramm @ 2021-07-17 10:45 ` Hans Hagen 2021-07-17 11:05 ` Henning Hraban Ramm 2021-10-22 9:31 ` Henning Hraban Ramm via ntg-context 2021-07-17 10:53 ` Henning Hraban Ramm 2021-07-17 10:53 ` Hans Hagen 2 siblings, 2 replies; 26+ messages in thread From: Hans Hagen @ 2021-07-17 10:45 UTC (permalink / raw) To: mailing list for ConTeXt users, Henning Hraban Ramm On 7/17/2021 12:20 PM, Henning Hraban Ramm wrote: > >> Am 17.07.2021 um 11:53 schrieb Bruce Horrocks <ntg@scorecrow.com>: >> >> >> >>> On 16 Jul 2021, at 20:55, Hans Hagen <j.hagen@xs4all.nl> wrote: >>> >>> On 7/15/2021 10:30 PM, Bruce Horrocks wrote: >>>> On 15 Jul 2021, at 18:58, Hans Hagen <j.hagen@xs4all.nl> wrote: >>>>> >>>>> I was wondering about that too. I admit that I looked into maps years ago but never could find quality data files. >>>> Does this help? >>>> <https://www.naturalearthdata.com> >>> i was halfway writing as reader for that fiel format when i noticed that is is also quite low res so i gave up on that and started playing (extending) with an more interesting alternative that mojca and i wrote years ago at a meeting >> >> Off the top of my head I'm not aware of any higher resolution sources of global data - what scale were you thinking of? > > Can you work with OpenStreetMap data? > > https://planet.openstreetmap.org > http://download.geofabrik.de > https://download.bbbike.org/osm/ > > I didn’t find excerpts that only have e.g. country borders or rivers. But with usual XML tools you could extract those. Indeed, that is what I was referring too. Mojca found this: https://osm-boundaries.com/ At a bachotex meeting (years ago, when the ctx group donated a nice roadmap display to the conference) we made an openstreetmap -> metapost style but afaik that never made it into a module. So, when I remembered that I updated it. I can now render my hometown (need to figure out colors) quite okay. (One can export an osm file in openstreetmap but with some limitations on size.) I have to play a bit more with the style before I define it useable but the interface is liek this: % where i live \startMPpage draw lmt_openstreetmap [ filename = "hasselt.osm" grid = "dots", ] ; \stopMPpage % island in paris \startMPpage draw lmt_openstreetmap [ filename = "e:/tmp/map.osm" ] ; \stopMPpage The hasselt osm file is sime 12 MB, the colorful hasselt pdf file just below 1 MB so that's okay (3.7 sec processing time on my machine so if all claims are right sub seconds on a fast new apple). Of course I need to make colors and what gets rendered configurable (via the interface). It's more about the fun aspect .. no need to typeset complete routes because that's what the web is for. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-17 10:45 ` Hans Hagen @ 2021-07-17 11:05 ` Henning Hraban Ramm 2021-10-22 9:31 ` Henning Hraban Ramm via ntg-context 1 sibling, 0 replies; 26+ messages in thread From: Henning Hraban Ramm @ 2021-07-17 11:05 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: text/plain, Size: 3610 bytes --] > Am 17.07.2021 um 12:45 schrieb Hans Hagen <j.hagen@xs4all.nl>: > > On 7/17/2021 12:20 PM, Henning Hraban Ramm wrote: >>> Am 17.07.2021 um 11:53 schrieb Bruce Horrocks <ntg@scorecrow.com>: >>> >>> >>> >>>> On 16 Jul 2021, at 20:55, Hans Hagen <j.hagen@xs4all.nl> wrote: >>>> >>>> On 7/15/2021 10:30 PM, Bruce Horrocks wrote: >>>>> On 15 Jul 2021, at 18:58, Hans Hagen <j.hagen@xs4all.nl> wrote: >>>>>> >>>>>> I was wondering about that too. I admit that I looked into maps years ago but never could find quality data files. >>>>> Does this help? >>>>> <https://www.naturalearthdata.com> >>>> i was halfway writing as reader for that fiel format when i noticed that is is also quite low res so i gave up on that and started playing (extending) with an more interesting alternative that mojca and i wrote years ago at a meeting >>> >>> Off the top of my head I'm not aware of any higher resolution sources of global data - what scale were you thinking of? >> Can you work with OpenStreetMap data? >> https://planet.openstreetmap.org >> http://download.geofabrik.de >> https://download.bbbike.org/osm/ >> I didn’t find excerpts that only have e.g. country borders or rivers. But with usual XML tools you could extract those. > Indeed, that is what I was referring too. Mojca found this: > https://osm-boundaries.com/ Ah, our mails crossed... > At a bachotex meeting (years ago, when the ctx group donated a nice roadmap display to the conference) we made an openstreetmap -> metapost style but afaik that never made it into a module. So, when I remembered that I updated it. I can now render my hometown (need to figure out colors) quite okay. (One can export an osm file in openstreetmap but with some limitations on size.) > > I have to play a bit more with the style before I define it useable but the interface is liek this: > > % where i live > > \startMPpage > draw lmt_openstreetmap [ > filename = "hasselt.osm" > grid = "dots", > ] ; > \stopMPpage > > % island in paris > > \startMPpage > draw lmt_openstreetmap [ > filename = "e:/tmp/map.osm" > ] ; > \stopMPpage > > The hasselt osm file is sime 12 MB, the colorful hasselt pdf file just below 1 MB so that's okay (3.7 sec processing time on my machine so if all claims are right sub seconds on a fast new apple). > > Of course I need to make colors and what gets rendered configurable (via the interface). It's more about the fun aspect .. no need to typeset complete routes because that's what the web is for. For our architectural guides I make maps with OSM data and Maperitive. It’s a PITA (sooo slow with Mono on OSX and hadly documented), but works. Maperitive uses "mrules" style files (example attached). [call] mono --desktop Maperitive/Maperitive.Console.exe -defaultscript=false ../baukultur.mscript inkscape -z -f citymap.svgz -A citymap.pdf [baukultur.mscript] set-setting name=map.decoration.attribution value=false set-setting name=map.decoration.grid value=false set-setting name=map.decoration.scale value=false set-setting name=map.rendering.font-family value="AlegreyaSans" use-ruleset location=Maperitive/Rules/baukultur.mrules // load some additional data, e.g. markers load-source archiguide.osm // exported OSM city map load-source bonn.osm // Stadthalle BG move-pos y=50.68064 x=7.15849 zoom=17 set-home set-geo-bounds 7.153,50.6840,7.162,50.6772 set-print-bounds-geo 7.153,50.6840,7.162,50.6772 export-svg file=citymap.svgz compatibility=inkscape map-scale=5000 Hraban [-- Attachment #2: baukultur.mrules --] [-- Type: application/octet-stream, Size: 32360 bytes --] // Archiguide rendering rules for Maperitive based on default (Mapnik) // http://maperitive.net // Created by Igor Brejc, adapted by Hraban Ramm // Released under the Creative Commons Attribution-ShareAlike 3.0 License (http://creativecommons.org/licenses/by-sa/3.0/) // Updates by Michael <quelbs_at_gmail.com> // Icons used: Map icons CC-0 from SJJB Management (http://www.sjjb.co.uk/mapicons) features points, areas parking : amenity=parking // postbox : amenity=post_box postoffice : amenity=post_office // telephone : amenity=telephone fire station : amenity=fire_station police station : amenity=police hospital : building=hospital // recycling : amenity=recycling church : amenity=place_of_worship AND religion=christian // drinking water : amenity=drinking_water // bank : amenity=bank // atm : amenity=atm // toilets : amenity=toilets library : amenity=library tree : natural=tree school : amenity=school bus stop : highway=bus_stop railway station : railway=station mini roundabout : highway=mini_roundabout gate : barrier=gate tourism viewpoint : tourism=viewpoint // tourism hotel : tourism=hotel tourism museum : tourism=museum tourism attraction : tourism=attraction // amenity pub : amenity=pub // amenity fast_food : amenity=fast_food aerodrome : aeroway=aerodrome housenumber : [addr:housenumber] // These are not shown on Mapnik puffin : crossing_ref=puffin memorial : historic=memorial areas beach : natural=beach building : building //=yes OR building=hospital OR building=university OR building=college OR building=school water : natural=water OR waterway=riverbank OR landuse=reservoir OR landuse=basin OR waterway=dock village green : landuse=village_green forest : landuse=forest OR natural=wood farm : landuse=farm farmyard : landuse=farmyard grass : landuse=grass fell : natural=fell glacier : natural=glacier national park : boundary=national_park allotments : landuse=allotments academic : node[@isOneOf(amenity, university, college, school)] area[@isOneOf(amenity, university, college, school)] meadow : natural=meadow OR landuse=meadow nature reserve : leisure=nature_reserve // playground : leisure=playground car park: amenity=parking track : leisure=track graveyard : amenity=grave_yard OR landuse=cemetery military : landuse=military OR military=barracks park : leisure=park // leisure garden : leisure=garden leisure pitch : leisure=pitch leisure stadium : leisure=stadium //landuse retail : landuse=retail landuse industrial : landuse=industrial //commercial area : landuse=commercial residential area : landuse=residential aeroway apron : aeroway=apron aeroway terminal : aeroway=terminal highway pedestrian : highway=pedestrian orchard : landuse=orchard farmland : landuse=farmland quarry : landuse=quarry archipage : archiguide_page=yes lines oneway : oneway=yes OR oneway=true OR oneway=-1 coastline : natural=coastline river : waterway=river stream : waterway=stream canal : waterway=canal drain : waterway=drain dock : waterway=dock railway rail : railway=rail railway lightrail : railway=light_rail platform : railway=platform OR public_transport=platform line barrier : barrier=wall OR barrier=fence highway motorway : highway=motorway OR (highway=construction AND construction=motorway) highway motorway link : highway=motorway_link OR (highway=construction AND construction=motorway_link) highway trunk : highway=trunk OR (highway=construction AND construction=trunk) highway trunk link: highway=trunk_link OR (highway=construction AND construction=trunk_link) highway primary link : highway=primary_link OR (highway=construction AND construction=primary_link) highway primary : highway=primary OR (highway=construction AND construction=primary) highway secondary : highway=secondary OR (highway=construction AND construction=secondary) highway tertiary : highway=tertiary OR (highway=construction AND construction=tertiary) highway unclassified : highway=unclassified OR (highway=construction AND construction=unclassified) highway residential : highway=residential OR (highway=construction AND construction=residential) highway living_street : highway=living_street OR (highway=construction AND construction=living_street) highway construction : highway=construction highway service : highway=service highway pedestrian : highway=pedestrian highway track : highway=track highway footway : highway=footway highway cycleway : highway=cycleway highway path : highway=path //highway access private : access=private AND highway highway access destination : access=destination AND highway highway steps : highway=steps pier : man_made=pier bridge foot : bridge=yes AND (foot=yes OR highway=footway) historic citywalls : historic=citywalls OR historic=city_wall power_line : power=line OR power=minor_line aerialway closed: @isOneOf(aerialway,cable_car,gondola,mixed_lift) aerialway open: @isOneOf(aerialway,chair_lift,drag_lift) aeroway runway : aeroway=runway aeroway taxiway : aeroway=taxiway //boundary country : boundary=administrative AND (admin_level=2 OR admin_level=4) AND NOT natural=coastline //boundary province : boundary=administrative AND admin_level=6 //boundary municipal : boundary=administrative AND admin_level=8 contour major : contour[@isMulti(elevation, 100)] contour minor : contour[@isMulti(elevation, 20) and not @isMulti(elevation, 100)] gps tracks : gpstrack[] gps routes : gpsroute[] // Routes // route ncn : relation[type=route AND route=bicycle AND network=ncn] // route byway : relation[type=route AND route=bicycle AND network="National Byway"] route foot : relation[type=route AND route=foot] points // place city : place=city place town : place=town place village : place=village place hamlet : place=hamlet place locality: place=locality place isolated_dwelling : place=isolated_dwelling place suburb : place=suburb // diy : shop=doityourself // hair dresser : shop=hairdresser // supermarket : shop=supermarket // convenience : shop=convenience // bakery : shop=bakery // restaurant : amenity=restaurant or amenity=cafe // cafe : amenity=cafe // pharmacy : amenity=pharmacy peak : natural=peak // powertower : power=tower OR power=pole info : information=guidepost bollard : barrier=bollard // lift_gate : barrier=lift_gate aerialway station : aerialway=station motorway_junction : highway=motorway_junction gps waypoints : gpswaypoint[] gps trackpoints: gpstrack[].gpspoint[] gps routepoints: gpsroute[].gpspoint[] archiguide : archiguide_type=any properties map-background-color : #FFFFFF map-background-opacity : 0 map-sea-color : #B5D0D0 font-weight : bold font-family : AlegreyaSans text: @any([[name:de]],name,int_name,[[name:en]]) text-max-width : 7 text-halo-width : 15% text-halo-opacity : 0.75 text-align-horizontal : center text-align-vertical : center font-stretch : 0.9 map.rendering.lflp.min-buffer-space : 5 map.rendering.lflp.max-allowed-corner-angle : 40 rules target: gps tracks define line-color : red line-opacity : 0.75 min-zoom : 5 line-width : 5 draw : line target: gps routes define line-color : blue line-opacity : 0.75 line-style : dash min-zoom : 5 line-width : 5 draw : line target : gps waypoints define shape : circle shape-size : 8 line-color : green fill-opacity : 0 draw : shape target : gps trackpoints define min-zoom : 17 shape : square shape-size : 10 line-color : green line-width : 1 fill-opacity : 0 draw : shape target : gps routepoints define min-zoom : 12 shape : diamond shape-size : 10 line-color : green line-width : 1 fill-opacity : 0 draw : shape // ARCHIGUIDE target : archiguide define min-zoom : 5 shape : circle shape-size : 12 line-color : black line-width : 0 //1 fill-color : #6ABCDE fill-opacity : 0.5 for : era=1 define fill-color : #00a276 for : era=2 define fill-color : #00a56c for : era=3 define fill-color : #38a962 for : era=4 define fill-color : #55a856 for : era=5 define fill-color : #69ac4b for : era=6 define fill-color : #6ba63f for : era=7 define fill-color : #7ba53d for : era=8 define fill-color : #8aa33b for : era=9 define fill-color : #96a139 for : era=H define fill-color : #7DB573 for : era=D define fill-color : #B8A524 draw : shape define min-zoom : 5 topmost-layer : true text : archiguide_id //text : name font-size : 18 // 14 text-color : #0C8CBC //text-halo-width : 0 draw : text target : archipage define min-zoom : 12 line-color: magenta line-width: 2 fill-color: green fill-opacity : 0.5 draw : fill //draw : line define // topmost-layer : true text : archiguide_pagename text-color : red text-halo-width : 8 font-size : 36 draw : text target : $featuretype(point) if : place* define font-weight : bold text-max-width : 1000 text-align-horizontal : near if : *city define font-size : 6:8;14:20 min-zoom : 6 max-zoom : 14 placement-value : 1000 elseif : *town define font-size : 9:8;12:10;20:20 min-zoom : 9 placement-value : 20 elseif : *village define font-size : 12:10;20:20 min-zoom : 12 placement-value : 1 elseif : *hamlet define font-size : 14:8;20:16 min-zoom : 14 placement-value : 0.1 elseif : *locality define font-size : 14:8;20:16 min-zoom : 14 placement-value : 0.1 elseif : *isolated_dwelling define font-size : 15:8;20:14 min-zoom : 15 placement-value : 0.1 elseif : *suburb define font-size : 13:10;20:20 min-zoom : 13 text-color : white black 50% placement-value : 10 draw : text if : aerialway station define min-zoom:12 shape:square shape-size:12:3;16:8 fill-color:#7981B0 line-style:none text-offset-vertical:120% text-color:#8888FF draw:shape draw:text target : housenumber define min-zoom : 17 text : [[addr:housenumber]] text-halo-width : 0 font-size : 10 text-color: black //placement-value : 0.01 //draw : text target : playground define fill-color : #CCFEF0 line-style : none draw : fill define line-color : #ADCCB5 line-width : 0 draw : line define min-zoom : 17 placement-value : 0.05 draw : text target : $featuretype(area) define line-style : none //line-width : 1 if : forest define min-zoom : 9 fill-color : #8DC56C elseif : beach define min-zoom : 10 fill-color : #FEFEC0 elseif : farm define min-zoom : 9 fill-color : #E9D8BD elseif : farmyard define min-zoom : 9 fill-color : #DCBE91 elseif : fell define fill-color : #C5FF5B black 10% elseif : water define fill-color : #C8E6E6 elseif:academic define fill-color : #EEFBFF //line-color : #E5D2CC //line-style : solid elseif : residential area define //fill-color : #E6E6E6 fill-color : #FFFFFF //draw : text elseif : grass define fill-color : #F0FFEF elseif : allotments define fill-color : #E6CA97 elseif : meadow define fill-color : #F0FFEF elseif : nature reserve define fill-color : #B1E69C elseif : car park define fill-color : #FFFCEE elseif : park define fill-color : #F0FFEF //draw : text elseif : leisure garden define fill-color : #F0FFEF //draw : text elseif : graveyard define fill-color : #F0FFEF elseif : building define fill-color : #AAAAAA elseif : leisure pitch define fill-color : #77EECC elseif : leisure stadium define fill-color : #77EECC line-color : white line-style : solid elseif : track define fill-color : #77EECC elseif : village green define fill-color : #F0FFEF elseif : landuse retail define fill-color : #F0D9D9 line-color : #F4A19E draw : line elseif : landuse industrial define fill-color : #DFD1D6 elseif : commercial area define fill-color : #EFC8C8 elseif : military define fill-color : #99DDBB elseif : aeroway* define fill-color : #E9D1FE elseif : orchard define fill-color : #F0FFEF elseif : farmland define fill-color : #F0FFEF elseif : aerodrome define fill-color : #e9e8e3 line-style : solid line-color : #b3b3b0 black 10% elseif : quarry define fill-color : white line-style : solid line-color : #b3b3b0 black 10% fill-hatch : diagonalcross fill-hatch-color : #cccccc elseif : glacier define fill-color : #DDECEC line-style : dash line-color : #DDECEC black 10% elseif : *pedestrian for : area define min-zoom : 14 fill-color : #EDEDED line-color : #B1B1B1 black 20% line-style : solid draw : text else stop draw : fill if : building define min-zoom : 15 line-style : solid line-width : 0.25 line-color : #ffffff draw : line //for : amenity=hospital //stop define min-zoom : 17 if:academic define min-zoom:16 draw : text // aeroway taxiway : aeroway=taxiway // aeroway apron : aeroway=apron // aeroway terminal : aeroway=terminal target : aeroway runway define min-zoom : 11 line-color : #BBBBCC line-width : 11:2;15:20 draw : line target : aeroway taxiway define min-zoom : 11 line-color : #BBBBCC line-width : 11:1;15:6 draw : line target : glacier define min-zoom : 10 text-color : #A3A3FE draw : text target : boundary* define line-color : #9E1A99 line-opacity : 0.5 if : boundary country define line-width : 6:1;9:3;10:6 elseif : boundary province define min-zoom : 4 line-width : 4:1;11:3 line-style : dash elseif : boundary municipal define min-zoom : 12 line-width : 12:1;14:2 line-style : dash draw : line target : national park define fill-color : #8DC56C fill-opacity : 0.2 line-style : none draw : fill define line-color : #8DC56C black 20% line-opacity : 0.5 line-width : 3 line-style : dash font-size : 3:3;12:12 text-color : green font-weight : normal draw : line draw : text target : peak define shape : triangle shape-size : 12 fill-color : #D08F55 line-style : none min-zoom : 11 draw : shape define text : @if(name, name @if(ele, "\n(" ele ")"), ele) text-color : #ae4242 min-zoom : 13 font-size : 10 text-max-width : 10 text-offset-vertical : 100% text-align-vertical : near draw : text target : info define min-zoom : 16 text : "i" text-color : #734A08 font-size : 20 font-family : Alegreya-Regular text-halo-width : 0 draw : text target : lift_gate define min-zoom : 16 shape : custom shape-def : f:#3E3E3E;p:#3E3E3E;-1,1;-1,-3;-3,-3;-3,3;-1,3;-1,2;4,2;4,1;Z shape-size : 14:7;20:12 line-width : 1 draw : shape target : bollard define min-zoom : 16 fill-color : #7D7D7D line-style : none shape-size : 16:1;18:2 draw : shape target : powertower define min-zoom: 14 shape : custom shape-def : m:-1,1;l:1,1,1,-1,-1,-1,-1,1,1,-1;m:-1,-1;l:1,1 shape-size : 14:2;20:9 line-width : 1 draw : shape target : power_line define min-zoom: 16 line-width: 1 line-color : #5c5c5c white 50% for : power=line define line-color : #5c5c5c min-zoom : 14 line-width: 1 draw : line target:aerialway * define min-zoom:12 line-width:1 line-style:solid line-color:#999 draw:line draw:text target:aerialway closed define min-zoom:12 shape:circle shape-size:1 shape-spacing:20 draw:shape target:aerialway open define min-zoom:12 shape:custom shape-def:l:0,1,0,-1 shape-spacing:5 shape-size:3 line-width:1 draw:shape target : platform define min-zoom : 13 line-color : gray line-width : 3 draw : line target : railway rail define min-zoom : 13 line-style : dashlong line-color : white line-width : 2 border-style : solid border-color : gray border-width : 25% draw : line define min-zoom : 6 max-zoom : 13 line-style : none line-color : white black 30% line-width : 6:1;8:1;12:1.5 draw : line target : railway* define min-zoom : 13 line-color : gray line-width : 2 draw : line define min-zoom : 15 text-align-horizontal : center text-align-vertical : center //draw:text target : highway access* define min-zoom : 13 line-width : 13:1;15:2;18:4 //line-style : dash //line-color : #F7D4D4 line-color : #CCCCCC for : access=destination define //line-color : lightblue white 50% draw : line target : highway construction define min-zoom : 13 line-width : 13:2;15:4;18:10 //line-style : dot //line-color : yellow for : construction=tertiary OR construction=secondary OR construction=primary define //line-color : white draw : line target : motorway_junction define font-size : 11 min-zoom : 13 text-color : #849BBD text-halo-width : 25% text-offset-vertical : 150% draw: text target : highway* define font-size : 15:7;18:10 font-weight : bold line-color : #CCCCCC for : oneway=yes OR oneway=true define min-zoom : 15 shape : custom shape-def : 60,0,20,-40,20,-15,-60,-15,-60,15,20,15,20,40;Z shape-size : 12 shape-aspect : 0.75 shape-spacing : 6 fill-color : #EEEFFF line-style : none for : oneway=-1 define angle : 180 draw : shape define line-style : solid line-join : round line-start-cap : round line-end-cap : round if : *motorway* if : *link define line-width : 7:1;12:3;13:4;16:5;18:6 else define line-width : 7:1;9:2;12:3;13:7;16:10;18:12 define min-zoom : 12 //line-color : #849BBD border-style : none border-color : #849BBD black 20% border-width : 15% draw : line define min-zoom : 7 max-zoom : 12 border-style : none draw : line define min-zoom : 10 max-zoom : 20 font-family : AlegreyaSans-Medium text-align-horizontal : center text-align-vertical : center text : ref font-size : 12 text-color : #fcfcfb text-halo-width : 0 shape : custom shape-def : p:#809bc0;pw:5;f:#809bc0;m:-10,-10;l:10,-10;a:10,10,10,10;l:-10,10;a:10,10,-10,-10;z;p:#fcfcfb;pw:2;m:-10,-10;l:10,-10;a:10,10,10,10;l:-10,10;a:10,10,-10,-10;z shield-padding-left : 5 shield-padding-right : 5 shield-padding-top : 7 shield-padding-bottom : 7 shield-resize-mode : free //draw : shield elseif : *trunk* define min-zoom : 12 //line-color : #96D296 line-width : 11:1;13:2;15:10;18:12 border-style : none border-color : #96D296 black 20% border-width : 15% for : tunnel=yes define border-style : dot draw : line define min-zoom : 7 max-zoom : 12 border-style : none draw : line elseif : *primary* define min-zoom : 11 //line-color : #ECA2A3 line-width : 11:2;12:2;15:10;18:12 border-style : none border-color : #ECA2A3 black 20% border-width : 15% for : tunnel=yes define border-style : dot draw : line define min-zoom : 7 max-zoom : 11 border-style : none draw : line define min-zoom : 13 max-zoom : 20 draw : text elseif : *secondary define min-zoom : 12 //line-color : #FDD6A4 line-width : 10:1;11:2;13:2;15:10;18:12 border-style : none border-color : #CAA36F border-width : 5% for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 border-width : 8% draw : line define min-zoom : 8.5 max-zoom : 12 border-style : none draw : line define min-zoom : 13 max-zoom : 20 draw : text elseif : *tertiary define min-zoom : 13 //line-color : #FEFEB2 line-width : 10:1;13:2;15:10;18:12 border-style : none border-color : #FEFEB2 black 20% border-width : 15% for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 draw : line define min-zoom : 10 max-zoom : 13 line-color : white black 25% border-style : none draw : line define min-zoom : 15 max-zoom : 20 draw : text elseif : *service define min-zoom : 13 //line-color : magenta line-width : 12:0.5;13:1;15:3;18:5 border-style : none border-color : #FEFEB2 black 20% border-width : 15% for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 draw : line draw : text elseif : *pedestrian for : not area define min-zoom : 13 line-color : #EDEDED line-width : 7:0.6;9:1;10:1.2;12:2.5;13:3;16:5;18:6 border-style : none border-color : #B1B1B1 black 20% border-width : 15% for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 draw : line draw : text elseif : $regex("(.*residential)|(.*unclassified)") define min-zoom : 13 //line-color : white line-width : 12:1;13:1.5;15:6;18:15 border-style : none border-color : white black 25% border-width : 15% for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 draw : line define min-zoom : 10 max-zoom : 13 border-style : none //line-color : white black 25% draw : line define min-zoom : 15 max-zoom : 20 draw : text elseif : *living_street define min-zoom : 13 //line-color : white black 25% //line-color: magenta line-width : 12:1;13:1.5;15:6;18:15 border-style : none for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 draw : line define min-zoom : 15 max-zoom : 20 draw : text elseif : *track define min-zoom : 12.5 //line-color : #9D7517 line-width : 12.5:0.3;13:0.5;15:1;18:1.5 line-style : dash border-style : solid border-color : white border-width : 100% border-opacity : 0.3 for : tracktype=grade1 define line-style : solid line-width : 12.5:0.5;13:1;15:1.5;18:2 for : tracktype=grade2 define line-style: dashlong for : tracktype=grade3 define line-style: dash for : tracktype=grade4 define line-style: dashdot for : tracktype=grade5 define line-style: dashdotdot for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 draw : line draw : text elseif : *footway define min-zoom : 13 //line-color : #F68474 line-color: #dddddd line-width : 13:0.5;15:1;18:1.5 line-style : dot border-style : solid border-color : white border-width : 100% border-opacity : 0.3 for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 draw : line draw : text elseif : *cycleway define min-zoom : 13 line-color : #dddddd line-width : 13:0.5;15:1;18:1.5 line-style : dot border-style : solid border-color : white border-width : 100% border-opacity : 0.3 for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 border-opacity : 1 draw : line draw : text elseif : *path define min-zoom : 13 //line-color : #6E7C6D line-width : 13:0.5;15:1;18:1.5 line-style : dash border-style : solid border-color : white border-width : 100% border-opacity : 0.3 for : tunnel=yes define border-style : dot for : bridge=yes define border-color : #000 draw : line draw : text else stop target : highway steps define min-zoom : 16 shape : custom shape-def : -1,1, -1,-1, 1,-1, 1,1;Z shape-spacing : 2 shape-size : 16:1;20:3 shape-aspect : 3 fill-color : #aaaaaa line-style : none draw : shape target : pier define //line-color : #F1EEE8 line-width : 1:1;20:8 draw : line target : line barrier define min-zoom : 13 line-color : #333333 line-width : 0.5 for:barrier=fence define min-zoom:16 line-color : #ffffcc draw : line target : bridge foot define min-zoom : 13 line-color : white line-width : 7:0.6;9:1;10:1.2;12:2.5;13:3;16:5;18:6 border-style : solid border-color : #FEFEB2 black 20% border-width : 15% draw : line draw : text target : historic citywalls define min-zoom : 13 line-color : #8D968D line-width : 7:0.6;9:1;10:1.2;12:2.5;13:3;16:10 draw : line draw : text define target : river define line-color : #C8E6E6 line-width : 7:1;12:2;14:5 draw : line define min-zoom:13 font-size:13:8;16:12 text-color:#B5D0D0 font-weight:normal draw:text target : stream define line-color : #C8E6E6 line-width : 13:1;15:2 draw : line define min-zoom:13 font-size:13:8;16:12 text-color:#B5D0D0 font-weight:normal draw:text target : canal define min-zoom : 12 line-color : #C8E6E6 line-width : 12:1;17:8 draw : line define min-zoom:13 font-size:13:8;16:12 text-color:#B5D0D0 font-weight:normal draw:text target : drain define min-zoom : 13 line-color : #C8E6E6 line-width : 1 draw : line target: parking define icon-image : icons/SJJB/png/transport_parking.p.32.png min-zoom : 15 icon-width : 6 draw : icon target: bus stop define icon-image : icons/SJJB/png/transport_bus_stop.p.32.png min-zoom : 15 icon-width : 15:6;18:8 draw : icon target: railway station define min-zoom : 12 shape : square //line-color : #7981B0 line-color : #333333 // fill-color : #7981B0 fill-color : white shape-size : 12:5;18:8 draw : shape define min-zoom : 14 // font-size : 12 // text-color : #7981B0 // text-offset-vertical : -150% draw : text target: postbox define icon-image : icons/SJJB/png/amenity_post_box.p.32.png min-zoom : 16 icon-width : 6 //draw : icon target: postoffice define icon-image : icons/SJJB/png/amenity_post_office.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: telephone define icon-image : icons/SJJB/png/amenity_telephone.p.32.png min-zoom : 16 icon-width : 6 //draw : icon target: fire station define icon-image : icons/SJJB/png/amenity_firestation.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: hospital define icon-image : icons/SJJB/png/health_hospital.p.32.png min-zoom : 15 icon-width : 8 draw : icon define min-zoom : 16 text-offset-vertical : 150% text-color : #DA0092 draw : text target: police station define icon-image : icons/SJJB/png/amenity_police.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: cafe define icon-image : icons/SJJB/png/food_cafe.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: recycling define icon-image : icons/SJJB/png/amenity_recycling.p.32.png min-zoom : 16 icon-width : 6 draw : icon target: supermarket define icon-image : icons/SJJB/png/shopping_supermarket.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: diy define icon-image : icons/SJJB/png/shopping_diy.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: convenience define icon-image : icons/SJJB/png/shopping_convenience.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: mini roundabout define icon-image : icons/SJJB/png/transport_roundabout_anticlockwise.p.32.png min-zoom : 16 icon-width : 9 draw : icon target: church define icon-image : icons/SJJB/png/place_of_worship_christian3.p.32.png min-zoom : 16 icon-width : 8 define text-offset-vertical : 150% draw : text draw : icon target: drinking water define icon-image : icons/SJJB/png/food_drinkingtap.p.32.png min-zoom : 16 icon-width : 6 draw : icon target: bank define min-zoom : 17 text-color : #000000 text-offset-vertical : 150% draw : text define icon-image : icons/SJJB/png/money_bank2.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: atm define min-zoom : 17 text-color : #000000 text-offset-vertical : 150% draw : text define icon-image : icons/SJJB/png/money_atm2.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: restaurant define min-zoom : 17 text-color : #734a08 text-offset-vertical : 150% font-size : 10 //draw : text define icon-image : icons/SJJB/png/food_restaurant.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: hair dresser define icon-image : icons/SJJB/png/shopping_hairdresser.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: toilets define icon-image : icons/SJJB/png/amenity_toilets.p.32.png min-zoom : 16 icon-width : 6 draw : icon target: pharmacy define icon-image : icons/SJJB/png/health_pharmacy.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: library define icon-image : icons/SJJB/png/amenity_library.p.32.png min-zoom : 16 icon-width : 8 draw : icon target: bakery define min-zoom : 17 text-color : #2B80FE text-offset-vertical : 150% //draw : text define icon-image : icons/SJJB/png/shopping_bakery.p.32.png min-zoom : 16 icon-width : 8 draw : icon define min-zoom : 17 text-color : #AA33AA text-offset-vertical : 150% font-size : 10 //draw : text target: tree define icon-image : http://svn.openstreetmap.org/applications/rendering/mapnik/symbols/tree2.png min-zoom : 16 icon-width : 6 //draw : icon target: memorial define icon-image : icons/SJJB/png/tourist_memorial.p.32.png min-zoom : 16 icon-width : 8 //draw : icon target: school define icon-image : icons/SJJB/png/education_school.p.32.png min-zoom : 16 icon-width : 8 draw : icon define text-offset-vertical : 150% draw : text target : puffin define icon-image : icons/SJJB/png/transport_traffic_lights.p.32.png min-zoom : 16 icon-width : 8 draw : icon target : gate define icon-image : icons/SJJB/png/barrier_gate.p.32.png min-zoom : 16 icon-width : 7 draw : icon target : tourism* define min-zoom : 17 text-color : #2B80FE text-offset-vertical : 150% draw : text if : *hotel define icon-image : icons/SJJB/png/accommodation_hotel2.p.32.png min-zoom : 16 icon-width : 8 elseif : *viewpoint define icon-image : icons/SJJB/png/tourist_view_point.p.32.png min-zoom : 16 icon-width : 8 elseif : *museum define icon-image : icons/SJJB/png/tourist_museum.p.32.png min-zoom : 16 icon-width : 8 draw : text else stop draw : icon target : amenity* define min-zoom : 17 text-color : #856951 text-offset-vertical : 150% draw : text define min-zoom : 16 icon-width : 8 if : *pub define icon-image : icons/SJJB/png/food_pub.p.32.png elseif : *fast_food define icon-image : icons/SJJB/png/food_fastfood2.p.32.png else stop draw : icon target: contour* define line-color : #7f3300 line-opacity : 0.35 curved : true if : *major define map.rendering.contour.label : true min-zoom : 9 line-width : 11:0.1;11.9:1;12:2 font-size : 10 font-style : italic font-weight : normal text-halo-width : 35% text-halo-opacity : 1 text-halo-color : #F1EEE8 else define min-zoom : 12 line-width : 1 draw : contour target: coastline define line-color : #B5D0D0 line-width : 2 draw : line [-- Attachment #3: Type: text/plain, Size: 3 bytes --] [-- Attachment #4: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-17 10:45 ` Hans Hagen 2021-07-17 11:05 ` Henning Hraban Ramm @ 2021-10-22 9:31 ` Henning Hraban Ramm via ntg-context 2021-10-22 13:35 ` Hans Hagen via ntg-context 2021-10-22 14:16 ` Henning Hraban Ramm via ntg-context 1 sibling, 2 replies; 26+ messages in thread From: Henning Hraban Ramm via ntg-context @ 2021-10-22 9:31 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm > Am 17.07.2021 um 12:45 schrieb Hans Hagen <j.hagen@xs4all.nl>: > > > \startMPpage > draw lmt_openstreetmap [ > filename = "hasselt.osm" > grid = "dots", > ] ; > \stopMPpage > > The hasselt osm file is sime 12 MB, the colorful hasselt pdf file just below 1 MB so that's okay (3.7 sec processing time on my machine so if all claims are right sub seconds on a fast new apple). I finally tried this, hoping to replace my Maperitive workflow. With a Bonn map from https://download.bbbike.org/osm/bbbike/ of 724 MB I started it last night (~13 h before), and it still didn’t finish. No messages after: openstreetmap > processing file '/Users/hraban/Downloads/ConTeXt/Bonn.osm' openstreetmap > original size 713811948 bytes, stripped down to 603309215 bytes Maybe I should try smaller files ;) Hraban ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-10-22 9:31 ` Henning Hraban Ramm via ntg-context @ 2021-10-22 13:35 ` Hans Hagen via ntg-context 2021-10-22 14:16 ` Henning Hraban Ramm via ntg-context 1 sibling, 0 replies; 26+ messages in thread From: Hans Hagen via ntg-context @ 2021-10-22 13:35 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Hans Hagen On 10/22/2021 11:31 AM, Henning Hraban Ramm via ntg-context wrote: > >> Am 17.07.2021 um 12:45 schrieb Hans Hagen <j.hagen@xs4all.nl>: >> >> >> \startMPpage >> draw lmt_openstreetmap [ >> filename = "hasselt.osm" >> grid = "dots", >> ] ; >> \stopMPpage >> >> The hasselt osm file is sime 12 MB, the colorful hasselt pdf file just below 1 MB so that's okay (3.7 sec processing time on my machine so if all claims are right sub seconds on a fast new apple). > > I finally tried this, hoping to replace my Maperitive workflow. > > With a Bonn map from https://download.bbbike.org/osm/bbbike/ of 724 MB I started it last night (~13 h before), and it still didn’t finish. No messages after: > > openstreetmap > processing file '/Users/hraban/Downloads/ConTeXt/Bonn.osm' > openstreetmap > original size 713811948 bytes, stripped down to 603309215 bytes > > Maybe I should try smaller files ;) We hit a limti in lpeg that allocates memory by duplicating the size which then hits a top and falls back in allocating by + 1 every capture which then kind of stalls the xml interpretation. I can hack that to work (and need to check that with every lpeg update), but as we enter a next stage in th econversion mem starts going virtual anyway and I see my SSD being tortured so I aborted. More testing has to wait till I (if ever) have a faster machine, with (say) 64GB super fast memory. On my machine the still ok size is some 200MB. Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-10-22 9:31 ` Henning Hraban Ramm via ntg-context 2021-10-22 13:35 ` Hans Hagen via ntg-context @ 2021-10-22 14:16 ` Henning Hraban Ramm via ntg-context 2021-10-22 14:27 ` Hans Hagen via ntg-context 1 sibling, 1 reply; 26+ messages in thread From: Henning Hraban Ramm via ntg-context @ 2021-10-22 14:16 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Henning Hraban Ramm > Am 22.10.2021 um 11:31 schrieb Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>: > > >> Am 17.07.2021 um 12:45 schrieb Hans Hagen <j.hagen@xs4all.nl>: >> >> >> \startMPpage >> draw lmt_openstreetmap [ >> filename = "hasselt.osm" >> grid = "dots", >> ] ; >> \stopMPpage >> >> The hasselt osm file is sime 12 MB, the colorful hasselt pdf file just below 1 MB so that's okay (3.7 sec processing time on my machine so if all claims are right sub seconds on a fast new apple). > > I finally tried this, hoping to replace my Maperitive workflow. > > With a Bonn map from https://download.bbbike.org/osm/bbbike/ of 724 MB I started it last night (~13 h before), and it still didn’t finish. No messages after: > > openstreetmap > processing file '/Users/hraban/Downloads/ConTeXt/Bonn.osm' > openstreetmap > original size 713811948 bytes, stripped down to 603309215 bytes > > > Maybe I should try smaller files ;) Indeed: openstreetmap > processing file '/Users/hraban/Downloads/ConTeXt/Limburg.osm' openstreetmap > original size 12431810 bytes, stripped down to 8768209 bytes openstreetmap > xml data loaded openstreetmap > 859154 characters metapost code, preprocessing time 3.165 seconds ... pdfview | command: open "osm-test.pdf" 1>/dev/null 2>/dev/null & mtx-context | pdfview overhead: 0.005 seconds system | total runtime: 9.211 seconds of 9.328 seconds The PDF is 488 kB. Redefining color works, if you know what you’re looking for – and it’s partly really strange what is marked how... Seems like I should start to work on OSM again. Are there any plans for text labels, e.g. street names? (I guess these are really tricky.) Hraban ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-10-22 14:16 ` Henning Hraban Ramm via ntg-context @ 2021-10-22 14:27 ` Hans Hagen via ntg-context 0 siblings, 0 replies; 26+ messages in thread From: Hans Hagen via ntg-context @ 2021-10-22 14:27 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Hans Hagen On 10/22/2021 4:16 PM, Henning Hraban Ramm via ntg-context wrote: > >> Am 22.10.2021 um 11:31 schrieb Henning Hraban Ramm via ntg-context <ntg-context@ntg.nl>: >> >> >>> Am 17.07.2021 um 12:45 schrieb Hans Hagen <j.hagen@xs4all.nl>: >>> >>> >>> \startMPpage >>> draw lmt_openstreetmap [ >>> filename = "hasselt.osm" >>> grid = "dots", >>> ] ; >>> \stopMPpage >>> >>> The hasselt osm file is sime 12 MB, the colorful hasselt pdf file just below 1 MB so that's okay (3.7 sec processing time on my machine so if all claims are right sub seconds on a fast new apple). >> >> I finally tried this, hoping to replace my Maperitive workflow. >> >> With a Bonn map from https://download.bbbike.org/osm/bbbike/ of 724 MB I started it last night (~13 h before), and it still didn’t finish. No messages after: >> >> openstreetmap > processing file '/Users/hraban/Downloads/ConTeXt/Bonn.osm' >> openstreetmap > original size 713811948 bytes, stripped down to 603309215 bytes >> >> >> Maybe I should try smaller files ;) > > Indeed: > > openstreetmap > processing file '/Users/hraban/Downloads/ConTeXt/Limburg.osm' > openstreetmap > original size 12431810 bytes, stripped down to 8768209 bytes > openstreetmap > xml data loaded > openstreetmap > 859154 characters metapost code, preprocessing time 3.165 seconds > ... > pdfview | command: open "osm-test.pdf" 1>/dev/null 2>/dev/null & > mtx-context | pdfview overhead: 0.005 seconds > system | total runtime: 9.211 seconds of 9.328 seconds > > The PDF is 488 kB. > > > Redefining color works, if you know what you’re looking for – and it’s partly really strange what is marked how... > Seems like I should start to work on OSM again. yes, and we need to add more heuristics (i already added some after rendering don knuths university site (apart from the many fast food venue research institutes are also marked 'interestingly') > Are there any plans for text labels, e.g. street names? (I guess these are really tricky.) depends on how Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-17 10:20 ` Henning Hraban Ramm 2021-07-17 10:45 ` Hans Hagen @ 2021-07-17 10:53 ` Henning Hraban Ramm 2021-07-17 10:53 ` Hans Hagen 2 siblings, 0 replies; 26+ messages in thread From: Henning Hraban Ramm @ 2021-07-17 10:53 UTC (permalink / raw) To: mailing list for ConTeXt users [-- Attachment #1: Type: text/plain, Size: 1744 bytes --] > Am 17.07.2021 um 12:20 schrieb Henning Hraban Ramm <texml@fiee.net>: > >> >> Am 17.07.2021 um 11:53 schrieb Bruce Horrocks <ntg@scorecrow.com>: >> >> >> >>> On 16 Jul 2021, at 20:55, Hans Hagen <j.hagen@xs4all.nl> wrote: >>> >>> On 7/15/2021 10:30 PM, Bruce Horrocks wrote: >>>> On 15 Jul 2021, at 18:58, Hans Hagen <j.hagen@xs4all.nl> wrote: >>>>> >>>>> I was wondering about that too. I admit that I looked into maps years ago but never could find quality data files. >>>> Does this help? >>>> <https://www.naturalearthdata.com> >>> i was halfway writing as reader for that fiel format when i noticed that is is also quite low res so i gave up on that and started playing (extending) with an more interesting alternative that mojca and i wrote years ago at a meeting >> >> Off the top of my head I'm not aware of any higher resolution sources of global data - what scale were you thinking of? > > Can you work with OpenStreetMap data? > > https://planet.openstreetmap.org > http://download.geofabrik.de > https://download.bbbike.org/osm/ > > I didn’t find excerpts that only have e.g. country borders or rivers. But with usual XML tools you could extract those. There’s https://osm-boundaries.com, but it doesn’t really work (for me). You should also be able to select elements via Overpass API, but it doesn’t work reliably for me at http://overpass-turbo.eu This is the query for mainland Netherlands: curl --remote-name --remote-header-name --location --max-redirs -1 "https://osm-boundaries.com/Download/Submit?db=osm20210531&osmIds=-2323309,-1216720&format=GeoJSON&srid=4326&simplify=1" You also need an API key that depends on your OSM account. Result attached. Hraban [-- Attachment #2: OSMB-dcc52d93616707aa0f6d582c82816ed1034354d6.geojson.gz --] [-- Type: application/x-gzip, Size: 1540 bytes --] [-- Attachment #3: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-17 10:20 ` Henning Hraban Ramm 2021-07-17 10:45 ` Hans Hagen 2021-07-17 10:53 ` Henning Hraban Ramm @ 2021-07-17 10:53 ` Hans Hagen 2021-07-17 12:42 ` Arthur Rosendahl 2 siblings, 1 reply; 26+ messages in thread From: Hans Hagen @ 2021-07-17 10:53 UTC (permalink / raw) To: mailing list for ConTeXt users, Henning Hraban Ramm [-- Attachment #1: Type: text/plain, Size: 574 bytes --] Hi, Just as an example, the context meeting is att the attached location: 50°45’7” / 5°35’19” https://www.openstreetmap.org/export#map=18/50.75175/5.58883 (Okay, I need to use a railway track dash pattern "railway".) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- [-- Attachment #2: m-openstreetmap.pdf --] [-- Type: application/pdf, Size: 21614 bytes --] [-- Attachment #3: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-17 10:53 ` Hans Hagen @ 2021-07-17 12:42 ` Arthur Rosendahl 2021-07-17 18:50 ` Hans Hagen 0 siblings, 1 reply; 26+ messages in thread From: Arthur Rosendahl @ 2021-07-17 12:42 UTC (permalink / raw) To: Mailing list for ConTeXt users On Sat, Jul 17, 2021 at 12:53:33PM +0200, Hans Hagen wrote: > Just as an example, the context meeting is att the attached location: > > 50°45’7” / 5°35’19” > > https://www.openstreetmap.org/export#map=18/50.75175/5.58883 If you want official data you can try the Belgian cadastre: https://data.gov.be/en/dataset/tt098dcb-f5c7-49b8-8e0b-7c3811630d85 :-) Best, Arthur ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-17 12:42 ` Arthur Rosendahl @ 2021-07-17 18:50 ` Hans Hagen 2021-07-18 17:36 ` Henning Hraban Ramm 0 siblings, 1 reply; 26+ messages in thread From: Hans Hagen @ 2021-07-17 18:50 UTC (permalink / raw) To: Mailing list for ConTeXt users, Arthur Rosendahl On 7/17/2021 2:42 PM, Arthur Rosendahl wrote: > On Sat, Jul 17, 2021 at 12:53:33PM +0200, Hans Hagen wrote: >> Just as an example, the context meeting is att the attached location: >> >> 50°45’7” / 5°35’19” >> >> https://www.openstreetmap.org/export#map=18/50.75175/5.58883 > > If you want official data you can try the Belgian cadastre: > https://data.gov.be/en/dataset/tt098dcb-f5c7-49b8-8e0b-7c3811630d85 :-) Yet another format? No way. I managed to go big so for instance the area where the colorado user group is located: https://www.openstreetmap.org/export#map=12/40.5117/-104.9496 produces a 122 MB osm file https://overpass-api.de/api/map?bbox=-105.1817,40.4096,-104.9493,40.6272 that gets turned into a 15 MB metapost file that becomes an 8.7 MB pdf file. Unfortunately it takes 36 seconds to be produced (9 seconds xml loading, 17 seconds map processing, 3 seconds mp -- which is not that bad -- and some 2.56 seconds pdf production) plus some 3 GB memory but that's still under my limit. Maybe a decent modern desktop can do it in half that time, who knows. Of course the rather detailed colorfull image is a challenge for the pdf viewer but (sumatra) it manages and one can then zoom in a lot. I tried the whole of slovenia to prove myself to mojca but overran my quota for that api (and I'm not in the mood to install all kind of stuff here). Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-17 18:50 ` Hans Hagen @ 2021-07-18 17:36 ` Henning Hraban Ramm 0 siblings, 0 replies; 26+ messages in thread From: Henning Hraban Ramm @ 2021-07-18 17:36 UTC (permalink / raw) To: mailing list for ConTeXt users > Am 17.07.2021 um 20:50 schrieb Hans Hagen <j.hagen@xs4all.nl>: > > On 7/17/2021 2:42 PM, Arthur Rosendahl wrote: >> On Sat, Jul 17, 2021 at 12:53:33PM +0200, Hans Hagen wrote: >>> Just as an example, the context meeting is att the attached location: >>> >>> 50°45’7” / 5°35’19” >>> >>> https://www.openstreetmap.org/export#map=18/50.75175/5.58883 >> If you want official data you can try the Belgian cadastre: >> https://data.gov.be/en/dataset/tt098dcb-f5c7-49b8-8e0b-7c3811630d85 :-) > Yet another format? No way. I managed to go big so for instance the area where the colorado user group is located: > > https://www.openstreetmap.org/export#map=12/40.5117/-104.9496 > > produces a 122 MB osm file > > https://overpass-api.de/api/map?bbox=-105.1817,40.4096,-104.9493,40.6272 > > that gets turned into a 15 MB metapost file that becomes an 8.7 MB pdf file. Unfortunately it takes 36 seconds to be produced (9 seconds xml loading, 17 seconds map processing, 3 seconds mp -- which is not that bad -- and some 2.56 seconds pdf production) plus some 3 GB memory but that's still under my limit. Maybe a decent modern desktop can do it in half that time, who knows. > > Of course the rather detailed colorfull image is a challenge for the pdf viewer but (sumatra) it manages and one can then zoom in a lot. I tried the whole of slovenia to prove myself to mojca but overran my quota for that api (and I'm not in the mood to install all kind of stuff here). I downloaded a few countries for you: https://sedna.fiee.net/d/328d53f6a3e04b23aee2/ Hraban ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-15 17:58 ` Hans Hagen 2021-07-15 20:30 ` Bruce Horrocks @ 2021-07-16 16:20 ` Gavin [not found] ` <E1B2010C-A435-46AD-BD8E-F4D930827791@me.com> 2 siblings, 0 replies; 26+ messages in thread From: Gavin @ 2021-07-16 16:20 UTC (permalink / raw) To: mailing list for ConTeXt users, Hans Hagen [-- Attachment #1.1: Type: text/plain, Size: 2090 bytes --] Hi Hans, Aditya, and all, Me: >>>> I’d like to use the mp-geo Metapost package with ConTeXt to draw simple >>> globes viewed from various directions. The package is here: >>>> >>>> https://melusine.eu.org/syracuse/poulecl/mp-geo/ <https://melusine.eu.org/syracuse/poulecl/mp-geo/> Aditya: >> Actually the data files are fairly simple: >> no_of_points >> <list of coordinates> >> So, it would be much simpler to read and parse it via lua rather than scantokens. Rest of the code simply determines a "view" of what to show. So, it can be a good exercise in lua-MP interface. Hans: > I was wondering about that too. I admit that I looked into maps years ago but never could find quality data files. This is great fun! I slightly altered Hans’ code to produce the most basic area preserving projection of North America (code and map below). If anyone else is playing with the mp-geo data, it is in arc minutes, so divide by 60 to get degrees. For my book I only want 5cm diameter globes with continents, so the map data in the mp-geo package is far more detailed than I need. The code is so fast, the detail doesn’t seem to be a problem. I just started learning Metapost a month ago, and it’s great. I know almost nothing about Lua, but this looks like a fun project for learning more! Thanks! Gavin P.S. I marked the location of our local ConTeXt users group on the map, in case any of you want to visit. \starttext \startluacode function mp.maptopath(filename) local t = { cycle = true } for phi, theta in string.gmatch(io.loaddata(filename),"%(([%+%-%d]+),([%+%-%d]+)%)") do t[#t+1] = { math.cosd(tonumber(phi)/60)*tonumber(theta+6125)/12, tonumber(phi)/12 } end mp.inject.path(t) end \stopluacode \startMPpage fill lua.mp.maptopath("data/usa1.dat"); fill lua.mp.maptopath("data/usa2.dat") ; fill lua.mp.maptopath("data/mexique.dat") ; fill lua.mp.maptopath("data/canada.dat") ; fill fullcircle scaled 5 shifted (0, 203) withcolor white; \stopMPpage \stoptext [-- Attachment #1.2.1: Type: text/html, Size: 4105 bytes --] [-- Attachment #1.2.2: HansMap.png --] [-- Type: image/png, Size: 19847 bytes --] [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
[parent not found: <E1B2010C-A435-46AD-BD8E-F4D930827791@me.com>]
* Re: mp-geo Metapost package with ConTeXt [not found] ` <E1B2010C-A435-46AD-BD8E-F4D930827791@me.com> @ 2021-07-16 19:51 ` Hans Hagen 2021-07-16 20:08 ` Alan Braslau 0 siblings, 1 reply; 26+ messages in thread From: Hans Hagen @ 2021-07-16 19:51 UTC (permalink / raw) To: Gavin Polhemus, mailing list for ConTeXt users On 7/16/2021 4:53 PM, Gavin Polhemus wrote: > P.S. I marked the location of our local ConTeXt users group on the map, in case any of you want to visit. 1/3rd of your user group fled the country and is way closer by where i live now, Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl ----------------------------------------------------------------- ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-16 19:51 ` Hans Hagen @ 2021-07-16 20:08 ` Alan Braslau 2021-07-26 21:29 ` Gavin via ntg-context 0 siblings, 1 reply; 26+ messages in thread From: Alan Braslau @ 2021-07-16 20:08 UTC (permalink / raw) To: mailing list for ConTeXt users, Hans Hagen, Gavin Polhemus On 16/07/21 21:51, Hans Hagen wrote: > On 7/16/2021 4:53 PM, Gavin Polhemus wrote: > >> P.S. I marked the location of our local ConTeXt users group on the >> map, in case any of you want to visit. > 1/3rd of your user group fled the country and is way closer by where i > live now, And in the same time zone! -- Alan ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-16 20:08 ` Alan Braslau @ 2021-07-26 21:29 ` Gavin via ntg-context 2021-07-26 23:01 ` Aditya Mahajan via ntg-context 0 siblings, 1 reply; 26+ messages in thread From: Gavin via ntg-context @ 2021-07-26 21:29 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Gavin Hi everyone, I’ve made great progress creating globes for my diagrams using the data in the mp-geo package and some ideas from Hans. I have a couple questions about moving information from Lua to MetaPost. Below is a MWE for illustration. I have two related questions: 1) Is there a way for MetaPost to grab information from a Lua table? Currently the MetaPost code calls a Lua function which has a single line returning the information from the table. Is this necessary, or is these something in MetaPost that can get a path or color from a Lua table? 2) While I’m having good luck with paths, colors are causing trouble. In the data set the color information is in strings with French names of the color, like “rouge.” If I hand this string to MetaPost, MetaPost doesn’t expand it into a color. It does work if it is a native color, like “red,” but not if it is a defined color and not if the color is in a Lua variable. Any suggestions? Thanks! Gavin The code below produces four pie shape wedges to show the different results of handling the color. They should all be red, but the last two are black. \startMPinclusions color rouge; % To avoid changing the data files, I need to define colors in French. rouge=(1,0,0); % For this MWE, I only define rouge. color mycolor; % Defining mycolor in MetaPost works great, as shown in the first shape. mycolor = rouge; \stopMPinclusions \startluacode myluapath = {{0,0}, {1,0,0,0,1,0.25}, {0.8,0.6,0.95,0.4}, cycle = true} myluacolor = “red” --% Data files are read by Lua, so the myluacolor will be a string (in French, but native colors don't work either). function mp.getpath() --% Is there a way for the MetaPost code to grab the path directly from the table? mp.inject.path(myluapath) end function mp.getred() --% Returning a string work for native colors. mp.inject.string("red") end function mp.getrouge() --% Returning a string does not work for defined mp.inject.string("rouge") end function mp.getcolor() --% Putting the string in a variable does not work. mp.inject.string(mycolor) end \stopluacode \starttext \startMPpage fill lua.mp.getpath() scaled 2.5cm withcolor mycolor; % MetaPost color definition works great. fill lua.mp.getpath() scaled 2.5cm shifted (0, -2cm) withcolor lua.mp.getred(); % Returning a string work for native colors. fill lua.mp.getpath() scaled 2.5cm shifted (0, -4cm) withcolor lua.mp.getrouge(); % Returning a string does not work for defined colors. fill lua.mp.getpath() scaled 2.5cm shifted (0, -6cm) withcolor lua.mp.getcolor(); % Putting the string in a variable does not work. \stopMPpage \stoptext ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-26 21:29 ` Gavin via ntg-context @ 2021-07-26 23:01 ` Aditya Mahajan via ntg-context 2021-07-27 6:12 ` Gavin via ntg-context 0 siblings, 1 reply; 26+ messages in thread From: Aditya Mahajan via ntg-context @ 2021-07-26 23:01 UTC (permalink / raw) To: Gavin via ntg-context; +Cc: Aditya Mahajan [-- Attachment #1: Type: text/plain, Size: 880 bytes --] On Mon, 26 Jul 2021, Gavin via ntg-context wrote: > 2) While I’m having good luck with paths, colors are causing trouble. In the data set the color information is in strings with French names of the color, like “rouge.” If I hand this string to MetaPost, MetaPost doesn’t expand it into a color. It does work if it is a native color, like “red,” but not if it is a defined color and not if the color is in a Lua variable. Any suggestions? \definecolor[rouge][red] should work. A better option will be use color palettes. This is very old code, but will give an idea of how to use palettes: https://github.com/adityam/visualcounter/blob/master/visualcounter.pdf Effectively all you need to do is add \setuppalet[name] at an appropriate place, and then the user can easily change the colors (rather than having them specified as part of data files). Aditya [-- Attachment #2: Type: text/plain, Size: 493 bytes --] ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-26 23:01 ` Aditya Mahajan via ntg-context @ 2021-07-27 6:12 ` Gavin via ntg-context 2021-07-27 6:29 ` Alan Braslau via ntg-context 0 siblings, 1 reply; 26+ messages in thread From: Gavin via ntg-context @ 2021-07-27 6:12 UTC (permalink / raw) To: Aditya Mahajan; +Cc: Gavin, Gavin via ntg-context Hi All, Getting Closer I asked: >> 2) While I’m having good luck with paths, colors are causing trouble. In the data set the color information is in strings with French names of the color, like “rouge.” If I hand this string to MetaPost, MetaPost doesn’t expand it into a color. It does work if it is a native color, like “red,” but not if it is a defined color and not if the color is in a Lua variable. Any suggestions? Aditya suggested: > \definecolor[rouge][red] should work. A better option will be use color palettes. This solves my problem of translating French colors into English, but not the problem of passing colors from Lua to MetaPost. If the string giving the color name is in a variable, it doesn’t go through. A path in a variable works. I’ve reduced my MWE below – no French, no MPinclusions, no new colors. Both pie slices should be red, but one is black. Any ideas on getting the color “red” passed from Lua to MetaPost when mycolor=“red”? Thanks! Gavin \startluacode mypath = {{0,0}, {2,0,0,0,2,0.5}, {1.6,1.2,1.9,0.8}, cycle = true} mycolor = “red” --% Data files are read by Lua, so the color of each object will be a string, like "red". function mp.getpath() --% Is there a way for the MetaPost code to grab the path directly from the table? mp.inject.path(mypath) end function mp.getred() --% Returning a string works. mp.inject.string("red") end function mp.getcolor() --% Putting the string in a variable does not work. mp.inject.string(mycolor) end \stopluacode \starttext \startMPpage fill lua.mp.getpath() scaled 2.5cm withcolor lua.mp.getred(); % Returning a string works. fill lua.mp.getpath() scaled 2.5cm shifted (0, -4cm) withcolor lua.mp.getcolor(); % Putting the string in a variable does not work. \stopMPpage \stoptext ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
* Re: mp-geo Metapost package with ConTeXt 2021-07-27 6:12 ` Gavin via ntg-context @ 2021-07-27 6:29 ` Alan Braslau via ntg-context 0 siblings, 0 replies; 26+ messages in thread From: Alan Braslau via ntg-context @ 2021-07-27 6:29 UTC (permalink / raw) To: mailing list for ConTeXt users; +Cc: Alan Braslau On 27/07/21 08:12, Gavin via ntg-context wrote: > Hi All, > > Getting Closer I asked: > >>> 2) While I’m having good luck with paths, colors are causing trouble. In the data set the color information is in strings with French names of the color, like “rouge.” If I hand this string to MetaPost, MetaPost doesn’t expand it into a color. It does work if it is a native color, like “red,” but not if it is a defined color and not if the color is in a Lua variable. Any suggestions? > > Aditya suggested: > >> \definecolor[rouge][red] should work. A better option will be use color palettes. > > This solves my problem of translating French colors into English, but not the problem of passing colors from Lua to MetaPost. If the string giving the color name is in a variable, it doesn’t go through. A path in a variable works. > > I’ve reduced my MWE below – no French, no MPinclusions, no new colors. Both pie slices should be red, but one is black. Any ideas on getting the color “red” passed from Lua to MetaPost when mycolor=“red”? I am not looking closely at the code, but in general we use fill fullcircle scaled 1cm withcolor red ; and this takes Metapost's knowledge of red, the rgb triplet (1,0,0). One can also use fill fullcircle scaled 1cm withcolor "red" ; as a string (quotation) and this passes Context's definition of the color. Alan -- Alan ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________ ^ permalink raw reply [flat|nested] 26+ messages in thread
end of thread, other threads:[~2021-10-22 14:27 UTC | newest] Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-07-14 14:43 mp-geo Metapost package with ConTeXt Gavin 2021-07-15 15:48 ` Hans Hagen 2021-07-15 16:22 ` Aditya Mahajan 2021-07-15 17:58 ` Hans Hagen 2021-07-15 20:30 ` Bruce Horrocks 2021-07-16 19:55 ` Hans Hagen 2021-07-17 9:53 ` Bruce Horrocks 2021-07-17 10:20 ` Henning Hraban Ramm 2021-07-17 10:45 ` Hans Hagen 2021-07-17 11:05 ` Henning Hraban Ramm 2021-10-22 9:31 ` Henning Hraban Ramm via ntg-context 2021-10-22 13:35 ` Hans Hagen via ntg-context 2021-10-22 14:16 ` Henning Hraban Ramm via ntg-context 2021-10-22 14:27 ` Hans Hagen via ntg-context 2021-07-17 10:53 ` Henning Hraban Ramm 2021-07-17 10:53 ` Hans Hagen 2021-07-17 12:42 ` Arthur Rosendahl 2021-07-17 18:50 ` Hans Hagen 2021-07-18 17:36 ` Henning Hraban Ramm 2021-07-16 16:20 ` Gavin [not found] ` <E1B2010C-A435-46AD-BD8E-F4D930827791@me.com> 2021-07-16 19:51 ` Hans Hagen 2021-07-16 20:08 ` Alan Braslau 2021-07-26 21:29 ` Gavin via ntg-context 2021-07-26 23:01 ` Aditya Mahajan via ntg-context 2021-07-27 6:12 ` Gavin via ntg-context 2021-07-27 6:29 ` Alan Braslau via ntg-context
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).