class _Datasource(Datasource,_injector):
  def describe(self):
    return Describe(self)

def Datasource (**keywords):
  return CreateDatasource(keywords)

# convinience factory methods

def Shapefile(**keywords):
  keywords['type'] = 'shape'
  return CreateDatasource(keywords)

def PostGIS(**keywords):
  keywords['type'] = 'postgis'
  return CreateDatasource(keywords)

def Raster(**keywords):
  keywords['type'] = 'raster'
  return CreateDatasource(keywords)

#register datasources
from mapnik import DatasourceCache
DatasourceCache.instance().register_datasources('%s' % inputpluginspath)
#register some fonts
from mapnik import FontEngine
FontEngine.instance().register_font('%s/Vera.ttf' % fontscollectionpath)
#set dlopen flags back to the original
setdlopenflags(flags)

def Datasource(**keywords):
    return CreateDatasource(keywords)


# convinience factory methods


def Shapefile(**keywords):
    keywords['type'] = 'shape'
    return CreateDatasource(keywords)


def PostGIS(**keywords):
    keywords['type'] = 'postgis'
    return CreateDatasource(keywords)


def Raster(**keywords):
    keywords['type'] = 'raster'
    return CreateDatasource(keywords)


#register datasources
from mapnik import DatasourceCache
DatasourceCache.instance().register_datasources('%s' % inputpluginspath)
#register some fonts
from mapnik import FontEngine
FontEngine.instance().register_font('%s/Vera.ttf' % fontscollectionpath)
#set dlopen flags back to the original
setdlopenflags(flags)
from mapnik import register_fonts, FontEngine
custom_fonts_dir = '/Users/thomas/Library/Fonts'
register_fonts(custom_fonts_dir)
for face in FontEngine.face_names(): print face
Beispiel #4
0
map_minor_grid_idx = map_ref_idx

# Generate symbols
print('Creating symbols...')
call("../symbols.sh " + map_ref_idx, shell=True)
print('Finished creating symbols')

# Convert MML to XML
print('Creating XML file...')
call("carto grough_map.mml > grough_map.xml", shell=True)
stylesheet = 'grough_map.xml'

# Custom fonts
print('Registering typefaces...')
register_fonts('/vagrant/source/typefaces/')
for face in font.face_names():
    print('...' + face)

# Connect to the database
#pg_conn_string = "host='localhost' dbname='grough' user='******' password='******'"
pg_conn_string = "host='localhost' dbname='grough-map' user='******'"
print('Connecting to PG database...')
pg_conn = psycopg2.connect(pg_conn_string)
pg_cursor = pg_conn.cursor()
print('Connected to database.')

print('Target grid square is ', map_ref_idx, '...')
print('Target major grid is ', map_major_grid_idx, '...')
print('Target file is ', map_target, '...')

# Query the grid square in the fishnet