1 |
# Copyright (C) 2003 by Intevation GmbH |
# Copyright (C) 2003, 2004 by Intevation GmbH |
2 |
# Authors: |
# Authors: |
3 |
# Jan-Oliver Wagner <[email protected]> |
# Jan-Oliver Wagner <[email protected]> |
4 |
# |
# |
33 |
from Thuban.Model.layer import BaseLayer |
from Thuban.Model.layer import BaseLayer |
34 |
from Thuban.Model.proj import Projection |
from Thuban.Model.proj import Projection |
35 |
from Thuban.Model.extension import Extension |
from Thuban.Model.extension import Extension |
36 |
from Thuban.Model.resource import read_proj_file |
from Thuban.Model.resource import get_system_proj_file, EPSG_PROJ_FILE, \ |
37 |
|
EPSG_DEPRECATED_PROJ_FILE |
38 |
from Thuban.UI.command import registry, Command |
from Thuban.UI.command import registry, Command |
39 |
import Thuban.UI.mainwindow |
import Thuban.UI.mainwindow |
40 |
from Thuban import _ |
from Thuban import _ |
44 |
def epsg_code_to_projection(epsg): |
def epsg_code_to_projection(epsg): |
45 |
"""Find the projection for the given epsg code. |
"""Find the projection for the given epsg code. |
46 |
|
|
47 |
epsg -- EPSG code as string |
epsg -- EPSG code as string |
48 |
""" |
""" |
49 |
proj_file, warnings = read_proj_file("Resources/Projections/epsg.proj") |
proj_file, warnings = get_system_proj_file(EPSG_PROJ_FILE) |
50 |
|
|
51 |
for proj in proj_file.GetProjections(): |
for proj in proj_file.GetProjections(): |
52 |
if proj.EPSGCode() == epsg: |
if proj.EPSGCode() == epsg: |
53 |
return proj |
return proj |
54 |
proj_file, warnings = read_proj_file("Resources/Projections/epsg-deprecated.proj") |
proj_file, warnings = get_system_proj_file(EPSG_DEPRECATED_PROJ_FILE) |
55 |
for proj in proj_file.GetProjections(): |
for proj in proj_file.GetProjections(): |
56 |
if proj.EPSGCode() == epsg: |
if proj.EPSGCode() == epsg: |
57 |
return proj |
return proj |