2
$\begingroup$

I have a GeoTIFF raster file which I would like to display superimposed on a map in GeoGraphics and combine it with other GeoListPlot graphics.

Since I know the corners of the GeoTIFF raster, I am trying to use

GeoGraphics[{GeoStyling["Image",img],Polygon[...]}] 

or

GeoGraphics[{GeoStyling["GeoImage",img],Polygon[...]}], 

where the Polygon is defined by the location of the corners of the image. However, the following command does not work (img is the raster image):

GeoGraphics[{GeoStyling[{"Image", img}], 
  Polygon[GeoPosition /@ {{0, 0}, {10, 0}, {10, 10}, {0, 10}}]}]

But replacing the Polygon with GeoDisk works:

GeoGraphics[{GeoStyling[{"Image", img}], 
  GeoDisk[GeoPosition[{0, 0}], 1000000]}]

and also replacing the image with just a color square works:

GeoGraphics[{GeoStyling[LightBlue], 
  Polygon[GeoPosition /@ {{0, 0}, {10, 0}, {10, 10}, {0, 10}}]}]

Here's a minimal version of the code that reads a GeoTIFF image and displays it on in the square given by the coordinates {{0, 0}, {10, 0}, {10, 10}, {0, 10}}:

img = Import["https://www.dropbox.com/s/4hbzcqwqpmihite/Napoleonstein20160702-COLOR.tif?dl=0", "GeoTIFF", "DownSamplingFactor" -> 16];
GeoGraphics[{GeoStyling[{"Image", img}],Polygon[GeoPosition[{{0, 0}, {10, 0}, {10, 10}, {0, 10}}]]}]

But if the corner points are given as GeoPositions, the GeoGraphics statement does not work:

GeoGraphics[{GeoStyling[{"Image", img}],Polygon[GeoPosition/@{{0, 0}, {10, 0}, {10, 10}, {0, 10}}]}]
$\endgroup$
3
  • $\begingroup$ Your file is unavailable. Please fix the link. Note that imgur.com accepts TIFF format. $\endgroup$ Commented Sep 13, 2017 at 23:14
  • $\begingroup$ Link should work now again. $\endgroup$
    – hippo3773
    Commented Oct 27, 2017 at 16:10
  • $\begingroup$ Thanks. The link now works, but the code Import["https://www.dropbox.com/s/4hbz... doesn't. $\endgroup$ Commented Oct 27, 2017 at 16:21

1 Answer 1

2
$\begingroup$

The solution is to write

GeoGraphics[{GeoStyling[{"Image", img}],
Polygon[GeoPosition[{{0, 0}, {10, 0}, {10, 10}, {0, 10}}]]}]

For some strange reason mapping GeoPosition on each of the corners inside the call to Polygon does not work.

$\endgroup$
1
  • $\begingroup$ Thanks, this answers also another related problem in this post $\endgroup$
    – SquareOne
    Commented Jul 21, 2017 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.