View Javadoc

1   /**
2    * 
3    * MIGRATOOL Program to migrate spatial databsets.
4    * Copyright (C) 2007 Fábio Luiz Leite Júnior
5    * Universidade Federal de Campina Grande
6    * contact: fabioleite@gmail.com
7    *
8    * This program is free software; you can redistribute it and/or
9    * modify it under the terms of the GNU General Public License
10   * as published by the Free Software Foundation; either version 2
11   * of the License, or (at your option) any later version.
12   *
13   * This program is distributed in the hope that it will be useful,
14   * but WITHOUT ANY WARRANTY; without even the implied warranty of
15   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   * GNU General Public License for more details.
17   *
18   * You should have received a copy of the GNU General Public License
19   * along with this program; if not, write to the Free Software
20   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21   *
22   * @author André Gomes
23   *
24   */
25   
26  package migratool.ora2pgsql;
27  
28  /**
29   * 
30   * MIGRATOOL Program to migrate spatial databsets.
31   * Copyright (C) 2007 Fábio Luiz Leite Júnior
32   * Universidade Federal de Campina Grande
33   * contact: fabioleite@gmail.com
34   *
35   * This program is free software; you can redistribute it and/or
36   * modify it under the terms of the GNU General Public License
37   * as published by the Free Software Foundation; either version 2
38   * of the License, or (at your option) any later version.
39   *
40   * This program is distributed in the hope that it will be useful,
41   * but WITHOUT ANY WARRANTY; without even the implied warranty of
42   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
43   * GNU General Public License for more details.
44   *
45   * You should have received a copy of the GNU General Public License
46   * along with this program; if not, write to the Free Software
47   * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
48   *
49   * @author andre
50   *
51   */
52  
53  public class SRIDConverter {
54  	public static final int POSTGIS = 0;
55  	public static final int ORACLE = 0;
56  	 
57  
58  	public static int getSRID(int source, int destination, int srid){
59  		System.out.println("Convertendo: " + srid);
60  		if ( source == ORACLE && destination == POSTGIS ){
61  			return convertFromOracleToPostgis(srid);
62  		}
63  		return -1;
64  	}
65  	/**
66  	 * @param srid
67  	 * @return
68  	 */
69  	private static int convertFromOracleToPostgis(int srid) {
70  		if ( srid == 8292 ){//sad69 lat long
71  			return 29100;		
72  		}else if ( srid == 8254){//Nad 27 for Alaska lat long
73  			return 26736;
74  		}else if ( srid == 82348 ){//UMT Zone 33, WGS 84
75  			return 32633;
76  		}
77  		return -1;
78  	}
79  
80  }