How to project a coordinate system on an image?

Hello, I’m trying to create a graph of some cities in Europe, I have tried guessing where cities would be but without much accuracy, and got an idea to just use an image and coordinate system to get direct coordinates and use those. But, haven’t found any package to do that.
Also, could I put an image as a background image of a graph using GraphMakie, or Graphs?
Thank you.

Like this?

using GMT
city_coords = [12.50 41.88; -9.13 38.72; -3.68 40.44; 2.32 48.85; 23.74 37.97; 16.36 48.21; 10.19 36.79];
city_names = ["Rome", "Lisbon", "Madrid", "Lutecia", "Athens", "Vienna", "Tunis"];
cities = mat2ds(city_coords, city_names);

# The image will be downloaded automatically
grdimage("@earth_day_03m", region=(-10,28,34,51), proj=:guess)

plot!(cities, connection="p", lw=1, lc=:yellow, marker=:circ, ms=0.2, mc=:white)
text!(cities, offset=0.3, font=(10,:red), show=true)



GMT syntax seems to be much more julian than before.


1 Like

Wow, that is great, but is there a way to make a map look like a rectangle? and to export coordinates, to be able to use them as a game. Maybe even get coordinates out as an array.
But, even if not it still makes making a game much easier. Really thank you.

If you want a rectangular map use a cylindrical projection or remove the proj=:guess option. Now regarding exporting coordinates, what coordinates? Those of the cities? They were imported via the city_coords variable. Nothing to export here.

Thanks, can I use the package with Graphs.jl, or somehow change the coordinates to the ones that I can use in the normal coordinate plane.

Sorry, don’t know and also don’t what Graphs.jl outputs.

What is the normal coordinate plane? You mentioned cities and one of the most normal coordinates for them are the geographical coordinates, which is what was used in the example.

Just one more question(I think), about GMT.jl. How do I install the GMT file that it works with, as the website they are linking to doesn’t exist anymore?
And sorry for not asking sooner, but how did you get coordinates for city_coords

I had opened an issue on GitHub.

Don’t know what links you followed but on the official GMT site you only have to follow the downloads tab.
But, specially on Windows, you only have to do ] add GMT and get everything. The wrapper and the lib.

Regarding the coordinates, I used a few from mirone/wcity_major.dat at master · joa-quim/mirone · GitHub but you can easily get them from GoogleEarth.