- Remove the import of pyprojection
- Delete pyprojection - Modify the WMS to use the new Projection class provided by Mapnik.
This commit is contained in:
parent
9170b57041
commit
6e41d4cb1f
7 changed files with 17 additions and 1721 deletions
|
@ -33,11 +33,6 @@ setdlopenflags(RTLD_NOW | RTLD_GLOBAL)
|
|||
from _mapnik import *
|
||||
from paths import inputpluginspath, fontscollectionpath
|
||||
|
||||
try:
|
||||
from mapnik.Projection import Projection, DEGREES
|
||||
except:
|
||||
pass
|
||||
|
||||
# The base Boost.Python class
|
||||
BoostPythonMetaclass = Coord.__class__
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
# $Id$
|
||||
|
||||
from exceptions import OGCException, ServerConfigurationError
|
||||
from mapnik import Map, Color, Envelope, render, rawdata, Image, Projection, render_to_file
|
||||
from mapnik import Map, Color, Envelope, render, rawdata, Image, Projection, render_to_file, Coord
|
||||
from PIL.Image import fromstring, new
|
||||
from PIL.ImageDraw import Draw
|
||||
from StringIO import StringIO
|
||||
|
@ -253,15 +253,15 @@ class CRS:
|
|||
return True
|
||||
return False
|
||||
|
||||
def Inverse(self, x, y):
|
||||
def inverse(self, x, y):
|
||||
if not self.proj:
|
||||
self.proj = Projection('init=%s' % str(self).lower())
|
||||
return self.proj.Inverse(x, y)
|
||||
self.proj = Projection('+init=%s' % str(self).lower())
|
||||
return self.proj.inverse(Coord(x, y))
|
||||
|
||||
def Forward(self, x, y):
|
||||
def forward(self, x, y):
|
||||
if not self.proj:
|
||||
self.proj = Projection('init=%s' % str(self).lower())
|
||||
return self.proj.Forward(x, y)
|
||||
self.proj = Projection('+init=%s' % str(self).lower())
|
||||
return self.proj.forward(Coord(x, y))
|
||||
|
||||
class CRSFactory:
|
||||
|
||||
|
|
|
@ -136,19 +136,19 @@ class ServiceHandler(WMSBaseServiceHandler):
|
|||
layername.text = layer.name
|
||||
env = layer.envelope()
|
||||
layerexgbb = ElementTree.Element('EX_GeographicBoundingBox')
|
||||
ll = self.crs.Inverse(env.minx, env.miny)
|
||||
ur = self.crs.Inverse(env.maxx, env.maxy)
|
||||
ll = self.crs.inverse(env.minx, env.miny)
|
||||
ur = self.crs.inverse(env.maxx, env.maxy)
|
||||
exgbb_wbl = ElementTree.Element('westBoundLongitude')
|
||||
exgbb_wbl.text = str(ll[0])
|
||||
exgbb_wbl.text = str(ll.x)
|
||||
layerexgbb.append(exgbb_wbl)
|
||||
exgbb_ebl = ElementTree.Element('eastBoundLongitude')
|
||||
exgbb_ebl.text = str(ur[0])
|
||||
exgbb_ebl.text = str(ur.x)
|
||||
layerexgbb.append(exgbb_ebl)
|
||||
exgbb_sbl = ElementTree.Element('southBoundLatitude')
|
||||
exgbb_sbl.text = str(ll[1])
|
||||
exgbb_sbl.text = str(ll.y)
|
||||
layerexgbb.append(exgbb_sbl)
|
||||
exgbb_nbl = ElementTree.Element('northBoundLatitude')
|
||||
exgbb_nbl.text = str(ur[1])
|
||||
exgbb_nbl.text = str(ur.y)
|
||||
layerexgbb.append(exgbb_nbl)
|
||||
layerbbox = ElementTree.Element('BoundingBox')
|
||||
layerbbox.set('CRS', str(self.crs))
|
||||
|
@ -158,13 +158,13 @@ class ServiceHandler(WMSBaseServiceHandler):
|
|||
layerbbox.set('maxy', str(env.maxy))
|
||||
layere = ElementTree.Element('Layer')
|
||||
layere.append(layername)
|
||||
if layer.title():
|
||||
if layer.title:
|
||||
layertitle = ElementTree.Element('Title')
|
||||
layertitle.text = layer.title()
|
||||
layertitle.text = layer.title
|
||||
layere.append(layertitle)
|
||||
if layer.abstract():
|
||||
if layer.abstract:
|
||||
layerabstract = ElementTree.Element('Abstract')
|
||||
layerabstract.text = layer.abstract()
|
||||
layerabstract.text = layer.abstract
|
||||
layere.append(layerabstract)
|
||||
layere.append(layerexgbb)
|
||||
layere.append(layerbbox)
|
||||
|
|
|
@ -1,27 +0,0 @@
|
|||
Projection.i: SWIG interface file for PROJ.4 projection library.
|
||||
|
||||
Copyright (c) 2001 Meridian Environmental Technology, Inc
|
||||
All rights reserved.
|
||||
|
||||
Author: Douglas K. Rand <rand@meridian-enviro.com>
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions
|
||||
are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
SUCH DAMAGE.
|
|
@ -1,93 +0,0 @@
|
|||
# This file was created automatically by SWIG.
|
||||
import Projectionc
|
||||
class Projection:
|
||||
def __init__(self,*args):
|
||||
self.this = apply(Projectionc.new_Projection,args)
|
||||
self.thisown = 1
|
||||
|
||||
def __del__(self,Projectionc=Projectionc):
|
||||
if self.thisown == 1 :
|
||||
Projectionc.delete_Projection(self)
|
||||
def Forward(*args):
|
||||
val = apply(Projectionc.Projection_Forward,args)
|
||||
return val
|
||||
def Inverse(*args):
|
||||
val = apply(Projectionc.Projection_Inverse,args)
|
||||
return val
|
||||
def cobject(*args):
|
||||
val = apply(Projectionc.Projection_cobject,args)
|
||||
return val
|
||||
__setmethods__ = {
|
||||
"units" : Projectionc.Projection_units_set,
|
||||
"proj" : Projectionc.Projection_proj_set,
|
||||
}
|
||||
def __setattr__(self,name,value):
|
||||
if (name == "this") or (name == "thisown"): self.__dict__[name] = value; return
|
||||
method = Projection.__setmethods__.get(name,None)
|
||||
if method: return method(self,value)
|
||||
self.__dict__[name] = value
|
||||
__getmethods__ = {
|
||||
"units" : Projectionc.Projection_units_get,
|
||||
"proj" : Projectionc.Projection_proj_get,
|
||||
}
|
||||
def __getattr__(self,name):
|
||||
method = Projection.__getmethods__.get(name,None)
|
||||
if method: return method(self)
|
||||
raise AttributeError,name
|
||||
def __repr__(self):
|
||||
return "<C Projection instance at %s>" % (self.this,)
|
||||
|
||||
def __del__(self,Projectionc=Projectionc):
|
||||
if getattr(self, 'thisown', 0):
|
||||
Projectionc.delete_Projection(self)
|
||||
|
||||
class ProjectionPtr(Projection):
|
||||
def __init__(self,this):
|
||||
self.this = this
|
||||
self.thisown = 0
|
||||
self.__class__ = Projection
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#-------------- FUNCTION WRAPPERS ------------------
|
||||
|
||||
int_array = Projectionc.int_array
|
||||
|
||||
int_destroy = Projectionc.int_destroy
|
||||
|
||||
int_get = Projectionc.int_get
|
||||
|
||||
int_set = Projectionc.int_set
|
||||
|
||||
double_array = Projectionc.double_array
|
||||
|
||||
double_destroy = Projectionc.double_destroy
|
||||
|
||||
double_get = Projectionc.double_get
|
||||
|
||||
double_set = Projectionc.double_set
|
||||
|
||||
float_array = Projectionc.float_array
|
||||
|
||||
float_destroy = Projectionc.float_destroy
|
||||
|
||||
float_get = Projectionc.float_get
|
||||
|
||||
float_set = Projectionc.float_set
|
||||
|
||||
string_array = Projectionc.string_array
|
||||
|
||||
string_destroy = Projectionc.string_destroy
|
||||
|
||||
string_get = Projectionc.string_get
|
||||
|
||||
string_set = Projectionc.string_set
|
||||
|
||||
|
||||
|
||||
#-------------- VARIABLE WRAPPERS ------------------
|
||||
|
||||
DEGREES = Projectionc.DEGREES
|
||||
RADIANS = Projectionc.RADIANS
|
File diff suppressed because it is too large
Load diff
|
@ -1,30 +0,0 @@
|
|||
# This file is part of Mapnik (c++ mapping toolkit)
|
||||
# Copyright (C) 2005 Artem Pavlenko, Jean-Francois Doyon
|
||||
#
|
||||
# Mapnik is free software; you can redistribute it and/or
|
||||
# modify it under the terms of the GNU General Public License
|
||||
# as published by the Free Software Foundation; either version 2
|
||||
# of the License, or any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# $Id$
|
||||
|
||||
import glob
|
||||
|
||||
Import('env')
|
||||
|
||||
prefix = env['PYTHON_PREFIX'] + '/lib/python' + env['PYTHON_VERSION'] + '/site-packages/'
|
||||
|
||||
headers = [env['PYTHON_PREFIX'] + '/include/python' + env['PYTHON_VERSION']] + env['CPPPATH']
|
||||
|
||||
projection = env.SharedLibrary('Projectionc', 'Projection_wrap.c', LIBS=['proj','pthread'], SHLIBPREFIX='', CPPPATH=headers)
|
||||
|
||||
env.Alias(target='install', source=env.Install(prefix+'/mapnik/', [projection, 'Projection.py']))
|
Loading…
Reference in a new issue