Exemplo n.º 1
0
    def to_kmz(self, **kwargs):
        """ export to kmz file
        """
        llcrnrlon = self.extent[0]
        llcrnrlat = self.extent[2]

        urcrnrlon = self.extent[1]
        urcrnrlat = self.extent[3]

        pngsrtm = self.prefix+'_srtm.png'
        pngaster = self.prefix+'_aster.png'
        pngroute = self.prefix+'_route.png'
        pngcover = self.prefix+'_cover.png'
        kmzsrtm = self.prefix+'_srtm.kmz'
        kmzaster = self.prefix+'_aster.kmz'
        kmzroute = self.prefix+'_route.kmz'
        kmzcover = self.prefix+'_cover.kmz'

        #
        # srtm overlay
        #
        fig, ax = gkml.gearth_fig(self.extent,self.extent_c)

        #cs = ax.pcolormesh(self.hgts, cmap='jet')
        csrtm = ax.imshow(self.hgts,extent=self.extent,cmap='jet')


        fig.savefig(pngsrtm, transparent=True, format='png')
        #
        # aster overlay
        #
        fig, ax = gkml.gearth_fig(self.extent,self.extent_c)
        caster = ax.imshow(self.hgta,extent=self.extent,cmap='jet')

        fig.savefig(pngaster, transparent=True, format='png')
        #
        # route overlay
        #
        fig, ax = gkml.gearth_fig(self.extent,self.extent_c)
        sp = ax.scatter(self.pb[:,0], self.pb[:,1], c = -self.L,
                        s=30,linewidth=0,cmap='jet',vmax=-60, vmin=-120)
        fig.savefig(pngroute, transparent=True, format='png')
        #
        # cover overlay
        #
        fig, ax = gkml.gearth_fig(self.extent,self.extent_c)
        tc = ax.tripcolor(self.triang,
                          -self.coverage.flatten(),
                          shading='gouraud',
                          cmap='jet',
                          vmax=-60,
                          vmin=-120,
                          alpha = 1,
                          edgecolors='k',
                          linewidth=0.0)
        fig.savefig(pngcover, transparent=True, format='png')

        gkml.make_kml(self.extent,
                 figs = [pngroute],
                 kmzfile = kmzroute,
                 name = 'route')

        gkml.make_kml(self.extent,
                 figs = [pngcover],
                 kmzfile = kmzcover,
                 name = 'coverage')

        gkml.make_kml(self.extent,
                 figs = [pngsrtm],
                 kmzfile = kmzsrtm,
                 name = 'SRTM DSM')

        gkml.make_kml(self.extent,
                 figs = [pngaster],
                 kmzfile = kmzaster,
                 name = 'ASTER DSM')
Exemplo n.º 2
0
    def to_kmz(self, **kwargs):
        """ export to kmz file
        """
        llcrnrlon = self.extent[0]
        llcrnrlat = self.extent[2]

        urcrnrlon = self.extent[1]
        urcrnrlat = self.extent[3]

        pngsrtm = self.prefix + '_srtm.png'
        pngaster = self.prefix + '_aster.png'
        pngroute = self.prefix + '_route.png'
        pngcover = self.prefix + '_cover.png'
        kmzsrtm = self.prefix + '_srtm.kmz'
        kmzaster = self.prefix + '_aster.kmz'
        kmzroute = self.prefix + '_route.kmz'
        kmzcover = self.prefix + '_cover.kmz'

        #
        # srtm overlay
        #
        fig, ax = gkml.gearth_fig(self.extent, self.extent_c)

        #cs = ax.pcolormesh(self.hgts, cmap='jet')
        csrtm = ax.imshow(self.hgts, extent=self.extent, cmap='jet')

        fig.savefig(pngsrtm, transparent=True, format='png')
        #
        # aster overlay
        #
        fig, ax = gkml.gearth_fig(self.extent, self.extent_c)
        caster = ax.imshow(self.hgta, extent=self.extent, cmap='jet')

        fig.savefig(pngaster, transparent=True, format='png')
        #
        # route overlay
        #
        fig, ax = gkml.gearth_fig(self.extent, self.extent_c)
        sp = ax.scatter(self.pb[:, 0],
                        self.pb[:, 1],
                        c=-self.L,
                        s=30,
                        linewidth=0,
                        cmap='jet',
                        vmax=-60,
                        vmin=-120)
        fig.savefig(pngroute, transparent=True, format='png')
        #
        # cover overlay
        #
        fig, ax = gkml.gearth_fig(self.extent, self.extent_c)
        tc = ax.tripcolor(self.triang,
                          -self.coverage.flatten(),
                          shading='gouraud',
                          cmap='jet',
                          vmax=-60,
                          vmin=-120,
                          alpha=1,
                          edgecolors='k',
                          linewidth=0.0)
        fig.savefig(pngcover, transparent=True, format='png')

        gkml.make_kml(self.extent,
                      figs=[pngroute],
                      kmzfile=kmzroute,
                      name='route')

        gkml.make_kml(self.extent,
                      figs=[pngcover],
                      kmzfile=kmzcover,
                      name='coverage')

        gkml.make_kml(self.extent,
                      figs=[pngsrtm],
                      kmzfile=kmzsrtm,
                      name='SRTM DSM')

        gkml.make_kml(self.extent,
                      figs=[pngaster],
                      kmzfile=kmzaster,
                      name='ASTER DSM')