Add python PROJ.4 module under mapnik python API.

This makes the Projection class available from mapnik:

>>> from mapnik import Projection
registered datasource : raster
registered datasource : shape
registered datasource : postgis
>>> Projection
<class mapnik.Projection.Projection at 0xb7f7250c>
>>>
This commit is contained in:
Jean-Francois Doyon 2006-03-26 22:35:37 +00:00
parent 4fd22de310
commit 2d18a3a2c0
4 changed files with 1699 additions and 0 deletions

View file

@ -0,0 +1,27 @@
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.

View file

@ -0,0 +1,93 @@
# 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

View file

@ -0,0 +1,30 @@
# 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']))