# GeoGraphics added to a current GeoGraphics object

I need to make a GeoGraphics[] object then save it to disk, move it to another computer where I need to load in the object then add some more GeoGraphics[] primitives. Below is a simple example of what I think should work.

Warning: The code below will download an image from Google and save it to your hard drive in your $TemporaryDirectory location! If you run all the code I do remove the file. Get an image of one of my favorite camping locations then save it out: loc = {37.4826678, -110.6310902}; geobackdrop = GeoGraphics[GeoCenter -> GeoPosition[loc], GeoServer -> "http://mt0.google.com/vt/lyrs=s,h&x=2&y=3&z=1", GeoRange -> Quantity[2, "Kilometers"], AspectRatio -> 1]; file = FileNameJoin[{$TemporaryDirectory, "Moqui.wl"}];
Save[file, geobackdrop];
ClearAll[geobackdrop];


At this point, we should have a GeoGraphics[] object on disk. Now lets read it in and try to add a GeoDisk[].

 Get[file];
Cases[{geobackdrop},
GeoGraphics[a_, b___] :>
GeoGraphics[{
GeoDisk[loc, Quantity[.05, "Kilometers"]], a}, b]
][[1]]


Where is my Disk? Is there a clean way to add items to the GeoGraphics[] object I have read off the disk?

Run this to remove the file from your hard drive:

  If[FileExistsQ[file], DeleteFile[file]]
If[Not[FileExistsQ[file]],
Print["The file is gone!"]]


Thank you.

• Is Save/Get part essential for the problem? Is your cases method doing what you expect if you skip save/get? – Kuba May 17 '18 at 21:44
• Yes the Save/Get is not essential the Cases[] and I could have asked the question without it but then I expected the question "Why not just put the GeoDisk[] in at the start?" – c186282 May 17 '18 at 22:30
• To avoid that question add a note that you can't because you can't. It was createad earlier/took a long time/you imported it. Whatever :) – Kuba May 17 '18 at 22:35

The disk is there but it is hard to find because it is rather small and shaded in transparent black. It is easier to spot if you make it its boundary red:

Cases[{geobackdrop}, GeoGraphics[a_, b___] :> GeoGraphics[{
EdgeForm[{Red, Thick}],GeoDisk[loc, Quantity[.05, "Kilometers"]], a}, b]][[1]]


Btw., since this is somewhat counterintuitive: In order to change the style of the interior of the disk, you may use GeoStyling:

Cases[{geobackdrop}, GeoGraphics[a_, b___] :> GeoGraphics[{
GeoStyling[Directive[Opacity[1], Red]],
GeoDisk[loc, Quantity[.05, "Kilometers"]], a},
b]
][[1]]


• Thank you I feel rather silly but I did not look closely because I also got the warning: "Graphics is not a Graphics primitive or directive." Did you get this warning? – c186282 May 17 '18 at 23:40
• No error. Worked like a charm. (version 11.3 on macOS). No need to feel silly. I also didn't find it in the first place. :) – Henrik Schumacher May 17 '18 at 23:43
• Thanks. They both work for me also but I do get the warning. (Version 11.3 on Mint Linux) – c186282 May 18 '18 at 0:10
• Well, if it works (apart from the warning), then you can tell Mathematica to be Quiet... :) – Henrik Schumacher May 18 '18 at 0:11
• Yes, I have done that before and I'll do it here but it is not clean. – c186282 May 18 '18 at 0:14