コード例 #1
0
ファイル: helpers.py プロジェクト: dkm/django-airspace
#   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 Affero General Public
#   License along with this program.  If not, see
#   <http://www.gnu.org/licenses/>.

import osgeo.ogr
from airspace.models import AirSpaces
import json
import ossim

from django.contrib.gis.geos import Point, LineString, MultiLineString

ossim.init('XXX/ossim_preferences_template')

def loadFromGpx(gpxfilename, detectProjection=True):
    """
    From a GPX, loads all lines/multilines and returns a single
    geos representation (tracks are merged)
    """
    driver = osgeo.ogr.GetDriverByName('GPX')
    dataSource = driver.Open(gpxfilename, 0)

    # merge all track into a single track
    # this can be a problem, depending on why the there is multiple tracks...
    merged_points = []

    for i in xrange(dataSource.GetLayerCount()):
	layer = dataSource.GetLayer(i)
コード例 #2
0
ファイル: altiresolver.py プロジェクト: dkm/airspace-checker
 def __init__(self, ossim_config):
     self.config = ossim_config
     ossim.init(self.config)
コード例 #3
0
#   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 Affero General Public
#   License along with this program.  If not, see
#   <http://www.gnu.org/licenses/>.

import osgeo.ogr
from airspace.models import AirSpaces
import json
import ossim

from django.contrib.gis.geos import Point, LineString, MultiLineString

ossim.init('XXX/ossim_preferences_template')


def loadFromGpx(gpxfilename, detectProjection=True):
    """
    From a GPX, loads all lines/multilines and returns a single
    geos representation (tracks are merged)
    """
    driver = osgeo.ogr.GetDriverByName('GPX')
    dataSource = driver.Open(gpxfilename, 0)

    # merge all track into a single track
    # this can be a problem, depending on why the there is multiple tracks...
    merged_points = []

    for i in xrange(dataSource.GetLayerCount()):