3
$\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$
  • $\begingroup$ Your file is unavailable. Please fix the link. Note that imgur.com accepts TIFF format. $\endgroup$ – Alexey Popkov Sep 13 '17 at 23:14
  • $\begingroup$ Link should work now again. $\endgroup$ – hippo3773 Oct 27 '17 at 16:10
  • $\begingroup$ Thanks. The link now works, but the code Import["https://www.dropbox.com/s/4hbz... doesn't. $\endgroup$ – Alexey Popkov Oct 27 '17 at 16:21
3
$\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$
  • $\begingroup$ Thanks, this answers also another related problem in this post $\endgroup$ – SquareOne Jul 21 '17 at 22:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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