Ejemplo n.º 1
0
    def test_annotate_ll_local(self):
        self.start()

        cs = gxcs.Coordinate_system({
            'type': 'local',
            'lon_lat': (-96, 45),
            'datum': 'nad83',
            'azimuth': -30
        })
        cs = gxcs.Coordinate_system(
            "NAD27 / UTM zone 15N <425000,6500145,0,0,0,-30>")
        name = os.path.join(gx.gx().temp_folder(), "test")
        with gxmap.Map.new(file_name='mapplot_anoxy_rotated_cs_bug_UTM',
                           overwrite=True,
                           data_area=(0, 0, 5000, 3500),
                           coordinate_system=cs,
                           media="A3",
                           margins=(3, 3, 4, 3)) as map:

            mapfile = map.file_name

            map.scale_bar(location=(2, 0, 2), length=6, sections=5)
            map.surround()
            map.annotate_data_xy(grid=gxmap.GRID_LINES)
            map.annotate_data_ll(grid=gxmap.GRID_LINES,
                                 grid_pen=gxg.Pen(line_color='b',
                                                  line_thick=0.025),
                                 text_def=gxg.Text_def(height=0.18,
                                                       italics=True),
                                 top=gxmap.TOP_IN)

            map.surround()

        self.crc_map(mapfile)
        gxmap.delete_files(mapfile)
Ejemplo n.º 2
0
    def test_annotate_ll_4(self):
        self.start()

        with self._data_map(data_area=(350000, 7000000, 400000,
                                       7030000)) as map:
            mapfile = map.file_name
            map.annotate_data_xy(
                tick=0.1,
                grid=gxmap.GRID_LINES,
                text_def=gxg.Text_def(weight=gxg.FONT_WEIGHT_BOLD),
                top=gxmap.TOP_IN)
            map.annotate_data_ll(grid=gxmap.GRID_LINES,
                                 grid_pen=gxg.Pen(line_color='b',
                                                  line_thick=0.025),
                                 text_def=gxg.Text_def(height=0.18,
                                                       italics=True),
                                 top=gxmap.TOP_IN)
        self.crc_map(mapfile)
Ejemplo n.º 3
0
    def test_annotate_xy_1(self):
        self.start()

        with self._data_map() as map:
            mapfile = map.file_name
            map.annotate_data_xy(x_sep=1500,
                                 grid=gxmap.GRID_DOTTED,
                                 offset=0.5,
                                 text_def=gxg.Text_def(
                                     color='R', weight=gxg.FONT_WEIGHT_BOLD))

        self.crc_map(mapfile)
Ejemplo n.º 4
0
 def test_annotate_ll_2(self):
     self.start()
     with self._data_map(data_area=(350000, 7000000, 400000,
                                    7030000)) as map:
         mapfile = map.file_name
         map.annotate_data_xy()
         map.annotate_data_ll(grid=gxmap.GRID_LINES,
                              grid_pen=gxg.Pen(line_color='b',
                                               line_thick=0.015),
                              text_def=gxg.Text_def(color='r',
                                                    height=0.2,
                                                    italics=True),
                              top=gxmap.TOP_IN)
     self.crc_map(mapfile)
Ejemplo n.º 5
0
    def test_annotate_ll_1(self):
        self.start()

        with self._data_map(data_area=(350000, 7000000, 400000,
                                       7030000)) as map:
            mapfile = map.file_name
            map.annotate_data_ll(grid=gxmap.GRID_LINES,
                                 grid_pen=gxg.Pen(line_color='b'),
                                 text_def=gxg.Text_def(
                                     color='K127',
                                     font='cr.gfn',
                                     weight=gxg.FONT_WEIGHT_BOLD,
                                     italics=True))
        self.crc_map(mapfile)
Ejemplo n.º 6
0
    def test_annotate_xy_2(self):
        self.start()

        with self._data_map() as map:
            mapfile = map.file_name
            map.annotate_data_xy(x_sep=1500,
                                 tick=0.1,
                                 text_def=gxg.Text_def(
                                     color='G',
                                     weight=gxg.FONT_WEIGHT_ULTRALIGHT),
                                 grid=gxmap.GRID_CROSSES,
                                 grid_pen=gxg.Pen(line_color='b',
                                                  line_thick=0.015))

        self.crc_map(mapfile)
Ejemplo n.º 7
0
    def test_scale_2(self):
        self.start()

        with gxmap.Map.new(data_area=(350000, 7000000, 400000, 7030000),
                           coordinate_system='NAD83 / UTM zone 15N') as map:
            mapfile = map.file_name
            with gxv.View(map, 'base') as v:
                with gxg.Draw(v) as g:
                    g.rectangle(v.extent_clip)
            with gxv.View(map, 'data') as v:
                with gxg.Draw(v) as g:
                    g.rectangle(v.extent_clip)
            map.scale_bar()
            map.scale_bar(location=(2, 0, 2),
                          length=10,
                          sections=12,
                          pen=gxg.Pen(line_color='R'),
                          text_def=gxg.Text_def(color='B',
                                                weight=gxg.FONT_WEIGHT_BOLD))

        self.crc_map(mapfile)
Ejemplo n.º 8
0
    def test_north_arrow_1(self):
        self.start()

        with gxmap.Map.new(coordinate_system='m',
                           data_area=(0, 0, 20, 10),
                           scale=100) as map:
            mapfile = map.file_name

            with gxv.View(map, 'base') as v:
                with gxg.Draw(v) as g:
                    g.rectangle(v.extent_clip)
            with gxv.View(map, 'data') as v:
                with gxg.Draw(v) as g:
                    g.rectangle(v.extent_clip)

            map.north_arrow(location=(2, 0, 3),
                            inclination=-12,
                            declination=74.5,
                            text_def=gxg.Text_def(font='Calibri'))

        self.crc_map(mapfile)
Ejemplo n.º 9
0
    def test_scale_1(self):
        self.start()

        with gxmap.Map.new(data_area=(350000, 7000000, 400000, 7030000),
                           coordinate_system='ft') as map:
            mapfile = map.file_name
            with gxv.View(map, 'base') as v:
                with gxg.Draw(v) as g:
                    g.rectangle(v.extent_clip)
            with gxv.View(map, 'data') as v:
                with gxg.Draw(v) as g:
                    g.rectangle(v.extent_clip)
            map.scale_bar()
            map.scale_bar(location=(2, 0, 2), length=10, sections=12)
            map.scale_bar(location=(5, 0, 0),
                          length=8,
                          sections=2,
                          post_scale=True)
            map.scale_bar(location=(3, -3, 1.5),
                          length=4,
                          text_def=gxg.Text_def(height=0.2, italics=True),
                          post_scale=True)

        self.crc_map(mapfile)
Ejemplo n.º 10
0
                                     title='Res TMI\nnT',
                                     location=(1.2,0),
                                     cmap=agg.layer_color_map(0),
                                     cmap2=agg.layer_color_map(1))

        # contour the grid
        gxgroup.contour(v, 'TMI_contour', grid_file_name)

    # map title and creator tag
    with gxview.View.open(gmap, "base") as v:
        with gxgroup.Draw(v, 'title') as g:

            g.text("Tutorial Example\nresidual mag",
                   reference=gxgroup.REF_BOTTOM_CENTER,
                   location=(100, 10),
                   text_def=gxgroup.Text_def(height=3.5,
                                             weight=gxgroup.FONT_WEIGHT_BOLD))
            g.text("created by:" + gxc.gid,
                   location=(1, 1.5),
                   text_def=gxgroup.Text_def(height=1.2,
                                             italics=True))

    # add a map surround to the map
    gmap.surround(outer_pen='kt500', inner_pen='kt100', gap=0.1)

    # annotate the data view locations
    gmap.annotate_data_xy(grid=gxmap.GRID_CROSSES)
    gmap.annotate_data_ll(grid=gxmap.GRID_LINES,
                          grid_pen=gxgroup.Pen(line_color='b'),
                          text_def=gxgroup.Text_def(color='b',
                                                    height=0.15,
                                                    italics=True))