# Outline of a country as a polygon

I'd like to obtain a country map of France, as polygon xy positions so I can adjust the borders.

Currently I'm using:

i= GeoGraphics[{GeoStyling[None], Polygon[France (country)]}, GeoBackground -> None, GeoZoomLevel->1]


Which returns an image.

I then obtain a white on black outline of the country by:

e = EdgeDetect[i]


I get the coordinates of the outline by looking for white pixels:

p = PixelValuePositions[e, 1]


And then draw an outline around it:

ListCurvePlot[p]


This sort of works, but the results are choppy and ListCurvePlot seems to miss a lot of the borders. Furthermore, PixelValuePositions just returns a set of points which are ordered by how their XY positions on the image, not necessarily by which points are adjacent on the map. This would not be a problem for a straight horizontal border, but with vertical and irregular lines adjacent points end up being non-adjacent.

• See CountryData["France", "SchematicCoordinates"]. p.s. GeoGraphics is not an image but a GraphicsBox at the end (with image as background).
– Kuba
Oct 20, 2017 at 15:50

You can use the "FullCoordinates" property of the entity:

Entity["Country","France"]["FullCoordinates"]//Short


{{{-49.5791,69.2829},{-49.5787,69.2793},<<2808>>,{-49.5779,69.2817}},{<<1>>},{<<1>>},<<880>>,{<<1>>},{<<1>>},{<<1>>}}

This returns the x,y coordinates of France and all of its territories. If you just want the x,y coordinates of the mainland, then you can extract the lat-long coordinates from the polygon using:

latlong = Entity["Country", "France"]["Polygon"][[1, 1]];


Note that the above returns a list of polygons, so reverse needs to be applied at level 3:

Reverse[latlong, {3}] //Short


{{{-1.78469,43.3495},{-1.78446,43.3498},<<2476>>,{-1.73746,43.3301}},{{<<17>>,<<11>>},<<147>>}}

You can also use CountryData as suggested by @Kuba.