mp-geo Metapost package with ConTeXt
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
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 -----------------------------------------------------------------
On Thu, 15 Jul 2021, Hans Hagen 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
On 7/14/2021 4:43 PM, Gavin wrote: 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
On 7/15/2021 6:22 PM, Aditya Mahajan wrote:
On Thu, 15 Jul 2021, Hans Hagen 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
On 7/14/2021 4:43 PM, Gavin wrote: 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 -----------------------------------------------------------------
On 15 Jul 2021, at 18:58, Hans Hagen
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
On 7/15/2021 10:30 PM, Bruce Horrocks wrote:
On 15 Jul 2021, at 18:58, Hans Hagen
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 -----------------------------------------------------------------
On 16 Jul 2021, at 20:55, Hans Hagen
wrote: On 7/15/2021 10:30 PM, Bruce Horrocks wrote:
On 15 Jul 2021, at 18:58, Hans Hagen
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
Am 17.07.2021 um 11:53 schrieb Bruce Horrocks
: On 16 Jul 2021, at 20:55, Hans Hagen
wrote: On 7/15/2021 10:30 PM, Bruce Horrocks wrote:
On 15 Jul 2021, at 18:58, Hans Hagen
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
On 7/17/2021 12:20 PM, Henning Hraban Ramm wrote:
Am 17.07.2021 um 11:53 schrieb Bruce Horrocks
: On 16 Jul 2021, at 20:55, Hans Hagen
wrote: On 7/15/2021 10:30 PM, Bruce Horrocks wrote:
On 15 Jul 2021, at 18:58, Hans Hagen
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 -----------------------------------------------------------------
Am 17.07.2021 um 12:45 schrieb Hans Hagen
: On 7/17/2021 12:20 PM, Henning Hraban Ramm wrote:
Am 17.07.2021 um 11:53 schrieb Bruce Horrocks
: On 16 Jul 2021, at 20:55, Hans Hagen
wrote: On 7/15/2021 10:30 PM, Bruce Horrocks wrote:
On 15 Jul 2021, at 18:58, Hans Hagen
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
Am 17.07.2021 um 12:45 schrieb Hans Hagen
: \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
On 10/22/2021 11:31 AM, Henning Hraban Ramm via ntg-context wrote:
Am 17.07.2021 um 12:45 schrieb Hans Hagen
: \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 -----------------------------------------------------------------
Am 22.10.2021 um 11:31 schrieb Henning Hraban Ramm via ntg-context
: Am 17.07.2021 um 12:45 schrieb Hans Hagen
: \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
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
: Am 17.07.2021 um 12:45 schrieb Hans Hagen
: \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 -----------------------------------------------------------------
Am 17.07.2021 um 12:20 schrieb Henning Hraban Ramm
: Am 17.07.2021 um 11:53 schrieb Bruce Horrocks
: On 16 Jul 2021, at 20:55, Hans Hagen
wrote: On 7/15/2021 10:30 PM, Bruce Horrocks wrote:
On 15 Jul 2021, at 18:58, Hans Hagen
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
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 -----------------------------------------------------------------
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
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 -----------------------------------------------------------------
Am 17.07.2021 um 20:50 schrieb Hans Hagen
: 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
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
participants (6)
-
Aditya Mahajan
-
Arthur Rosendahl
-
Bruce Horrocks
-
Gavin
-
Hans Hagen
-
Henning Hraban Ramm