### The Maxima on-line user's manual

Algebra Calculator

#### Geomap

-- Graphic object: geomap (<numlist>) -- Graphic object: geomap (<numlist>,<3Dprojection>) Draws cartographic maps in 2D and 3D.

2D

This function works together with global variable `boundaries_array`.

Argument <numlist> is a list containing numbers or lists of numbers. All these numbers must be integers greater or equal than zero, representing the components of global array `boundaries_array`.

Each component of `boundaries_array` is an array of floating point quantities, the coordinates of a polygonal segment or map boundary.

`geomap (<numlist>)` flattens its arguments and draws the associated boundaries in `boundaries_array`.

This object is affected by the following graphic options: `line_width`, `line_type` and `color`.

Examples:

```     A simple map defined by hand:
(%i2) /* Vertices of boundary #0: {(1,1),(2,5),(4,3)} */
( bnd0: make_array(flonum,6),
bnd0[0]:1.0, bnd0[1]:1.0, bnd0[2]:2.0,
bnd0[3]:5.0, bnd0[4]:4.0, bnd0[5]:3.0 )\$
(%i3) /* Vertices of boundary #1: {(4,3),(5,4),(6,4),(5,1)} */
( bnd1: make_array(flonum,8),
bnd1[0]:4.0, bnd1[1]:3.0, bnd1[2]:5.0, bnd1[3]:4.0,
bnd1[4]:6.0, bnd1[5]:4.0, bnd1[6]:5.0, bnd1[7]:1.0)\$
(%i4) /* Vertices of boundary #2: {(5,1), (3,0), (1,1)} */
( bnd2: make_array(flonum,6),
bnd2[0]:5.0, bnd2[1]:1.0, bnd2[2]:3.0,
bnd2[3]:0.0, bnd2[4]:1.0, bnd2[5]:1.0 )\$
(%i5) /* Vertices of boundary #3: {(1,1), (4,3)} */
( bnd3: make_array(flonum,4),
bnd3[0]:1.0, bnd3[1]:1.0, bnd3[2]:4.0, bnd3[3]:3.0)\$
(%i6) /* Vertices of boundary #4: {(4,3), (5,1)} */
( bnd4: make_array(flonum,4),
bnd4[0]:4.0, bnd4[1]:3.0, bnd4[2]:5.0, bnd4[3]:1.0)\$
(%i7) /* Pack all together in boundaries_array */
( boundaries_array: make_array(any,5),
boundaries_array[0]: bnd0, boundaries_array[1]: bnd1,
boundaries_array[2]: bnd2, boundaries_array[3]: bnd3,
boundaries_array[4]: bnd4 )\$
(%i8) draw2d(geomap([0,1,2,3,4]))\$```

Auxiliary package `worldmap` sets global variable `boundaries_array` to real world boundaries in (longitude, latitude) coordinates. These data are in the public domain and come from `http://www-cger.nies.go.jp/grid-e/gridtxt/grid19.html`. Package `worldmap` defines also boundaries for countries, continents and coastlines as lists with the necessary components of `boundaries_array` (see file `share/draw/worldmap.mac` for more information). Package `worldmap` automatically loads package `worldmap`.

`          (%i1) load(worldmap)\$`
`          (%i2) c1: gr2d(geomap(Canada,United_States,`
`                                Mexico,Cuba))\$`
`          (%i3) c2: gr2d(geomap(Africa))\$`
`          (%i4) c3: gr2d(geomap(Oceania,China,Japan))\$`
`          (%i5) c4: gr2d(geomap(France,Portugal,Spain,`
`                                Morocco,Western_Sahara))\$`
`          (%i6) draw(columns  = 2,`
`                     c1,c2,c3,c4)\$`

Package `worldmap` is also useful for plotting countries as polygons. In this case, graphic object `geomap` is no longer necessary and the `polygon` object is used instead. Since lists are now used and not arrays, maps rendering will be slower. See also `make_poly_country` and `make_poly_continent` to understand the following code.

`          (%i1) load(worldmap)\$`
`          (%i2) mymap: append(`
`             [color      = white],  /* borders are white */`
`             [fill_color = red],             make_poly_country(Bolivia),`
`             [fill_color = cyan],            make_poly_country(Paraguay),`
`             [fill_color = green],           make_poly_country(Colombia),`
`             [fill_color = blue],            make_poly_country(Chile),`
`             [fill_color = "#23ab0f"],       make_poly_country(Brazil),`
`             [fill_color = goldenrod],       make_poly_country(Argentina),`
`             [fill_color = "midnight-blue"], make_poly_country(Uruguay))\$`
`          (%i3) apply(draw2d, mymap)\$`

3D

`geomap (<numlist>)` projects map boundaries on the sphere of radius 1 centered at (0,0,0). It is possible to change the sphere or the projection type by using `geomap (<numlist>,<3Dprojection>)`.

Available 3D projections:

* `[spherical_projection,<x>,<y>,<z>,<r>]`: projects map boundaries on the sphere of radius <r> centered at (<x>,<y>,<z>).

`               (%i1) load(worldmap)\$`
`               (%i2) draw3d(geomap(Australia), /* default projection */`
`                            geomap(Australia,`
`                                   [spherical_projection,2,2,2,3]))\$`

* `[cylindrical_projection,<x>,<y>,<z>,<r>,<rc>]`: re-projects spherical map boundaries on the cylinder of radius <rc> and axis passing through the poles of the globe of radius <r> centered at (<x>,<y>,<z>).

`               (%i1) load(worldmap)\$`
`               (%i2) draw3d(geomap([America_coastlines,Eurasia_coastlines],`
`                                   [cylindrical_projection,2,2,2,3,4]))\$`

* `[conic_projection,<x>,<y>,<z>,<r>,<alpha>]`: re-projects spherical map boundaries on the cones of angle <alpha>, with axis passing through the poles of the globe of radius <r> centered at (<x>,<y>,<z>). Both the northern and southern cones are tangent to sphere.

`               (%i1) load(worldmap)\$`
`               (%i2) draw3d(geomap(World_coastlines,`
`                                   [conic_projection,0,0,0,1,90]))\$`

See also `http://www.telefonica.net/web2/biomates/maxima/gpdraw/geomap` for more elaborated examples.

```(%o1)                                true
(%i2) ```

### Related Examples

c1: gr2d(geomap(Afga...

Calculate

c1: gr2d(geomap(afga...

Calculate

##### geomap

wxdraw3d(geomap(Austr...

Calculate

c1: gr2d(geomap(Gree...

Calculate

c1: gr2d(geomap(Gree...

Calculate

c1: gr2d(geomap(Gree...

Calculate

? geomap;

Calculate

? geomap;

Calculate

##### geomap-linsolve

eq1:x*4+y-2=y;

eq2:x+2=y;

linsolve([eq1,eq2],[x...

Calculate