Skip to content
/ gdal Public
forked from DLR-TS/gdal

GDAL is an open source X/MIT licensed translator library for raster and vector geospatial data formats. This is a mirror of the GDAL Subversion repository.

Notifications You must be signed in to change notification settings

plkms/gdal

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenDRIVE Driver for OGR

This repository focusses on the development of an OpenDRIVE driver for the OGR Simple Features Library. By extending GDAL/OGR with the ability to read OpenDRIVE XML files, a broad and well-established toolset of GIS functions will be made available for OpenDRIVE processing. This OGR extension is based on the work by Orozco Idrobo (2015) and Scholz et al. (2017). Currently, the still prototypical OpenDRIVE driver is not yet integrated into the official GDAL distribution. Steps to built the driver as a shared library against GDAL to provide a pluggable extension are described below.

Current Functionality

As of OpenDRIVE version 1.4 the specified coordinate reference system, given as PROJ.4 string, is correctly interpreted. For now one MultiLineString layer is created containing just the road reference line geometries.

Further To-Dos

Geometry:

  • Specify point sampling distance for mathematical geometries as layer creation option
  • Create 3D geometries from polynomial OpenDRIVE elevation profile
  • Add Point layer for road objects (e.g. signals, signs)
  • Add Polygon layer for driving lanes, parking spaces
  • Add additional LineString layer(s) to contain
    • driving lane boundaries
    • road marks
    • linear objects (e.g. guardrails, barriers)
  • Implement sampling of spiral geometries, with both curvStart and curvEnd != 0

Misc:

Building

0 Dependencies

The driver works only for GDAL 2.x. and does not support GDAL 1.x. It depends on the following libraries

and building it is divided into

  • building the original GDAL base library which we link our shared extension against, followed by
  • building the actual OpenDRIVE driver as shared library extension of GDAL/OGR.

We tested on Ubuntu Linux 16.04 x64 and Windows 7 x64. Get started by cloning the ogr/xodr branch of GDAL:

git clone https://github.com/DLR-TS/gdal.git -b ogr/xodr --single-branch <gdal>

If needed, substitute <gdal> with the desired path name to clone into.

1 Building on Linux

1.1 GDAL Base on Linux

We basically follow the official GDAL building instructions for Unix.

Configure GDAL to support creation of shared libraries. At least for our Ubuntu 16.04 test environment we also had to disable libtool because it caused problems during later linking of the driver shared library:

cd <gdal>/gdal/
./configure --prefix ~/dev/gdal/gdal/build -enable-shared --without-libtool --with-geos=yes

Check the output for successful recognition of geos and xerces. For Debug configuration append --enable-debug. Build with

make -f GNUmakefile

followed by a

make -f GNUmakefile install

which copies the resulting GDAL binaries and library into the abovely specified CMake --prefix directory.

1.2 OpenDRIVE Driver as Shared Library on Linux

Navigate into the OpenDRIVE OGR driver directory

cd <gdal>/gdal/ogr/ogrsf_frmts/xodr/

Configure the paths for all required Unix dependencies in XODRmake.opt. Then

make -f GNUmakefile plugin-install

This will build a shared library of the plugin and automatically copy it into GDAL's plugin directory relative to the CMake --prefix directory specified in the previous section.

2 Building on Windows

2.1 GDAL Base on Windows

We basically follow the official GDAL building instructions for Windows. Things have gotten easier starting from GDAL 2.3.x. where GDAL provides a comfortable script generate_vcxproj.bat to generate project definitions for recent Microsoft's Visual Studio editions. An exemplary project for Visual Studio 2015 x64 can be generated from the "VS2015 x64 Native Tools Command Prompt" as follows:

generate_vcxproj.bat 14.0 64 gdal_vs2015

Now configure your GEOS and Xerces dependencies by adding the corresponding include directory and library paths into a new lokal NMake configuration file nmake.local. It should contain something like the following (consider nmake.opt as a reference):

# GEOS
GEOS_DIR    = D:\dev\geos\distro
GEOS_CFLAGS = -I$(GEOS_DIR)\include -DHAVE_GEOS
GEOS_LIB    = $(GEOS_DIR)\lib\geos_c.lib

# Xerces
XERCES_DIR     = D:\dev\xerces-c-3.1.1-x86_64-windows-vc-10.0
XERCES_INCLUDE = -I$(XERCES_DIR)\include  -I$(XERCES_DIR)\include\xercesc
!IFNDEF DEBUG
XERCES_LIB = $(XERCES_DIR)\lib\xerces-c_3.lib
XERCES_DLL = $(XERCES_DIR)\bin\xerces-c_3_1.dll
!ELSE
XERCES_LIB = $(XERCES_DIR)\lib\xerces-c_3D.lib
XERCES_DLL = $(XERCES_DIR)\bin\xerces-c_3_1D.dll
!ENDIF

Open the generated .vcxproj in Visual Studio and build the base GDAL library for the desired configuration (e.g. Release or Debug). Alternatively, for an exemplary Release build use nmake from command line:

cd <gdal>/gdal/
nmake -f makefile.vc MSVC_VER=1900 WIN64=1

Lean back, enjoy a freshly brewed Lapsang Souchong and after a few minutes your raw GDAL library is built. To pack all executables and the library conveniently together specify the desired output directory GDAL_HOME by adding the following in your lokal configuration file nmake.local

GDAL_HOME="C:\dev\gdal\gdal\build"

and run nmake install afterwards

nmake -f makefile.vc MSVC_VER=1900 WIN64=1 install

2.2 OpenDRIVE Driver as Shared Library on Windows

Navigate into the OpenDRIVE OGR driver directory

cd <gdal>/gdal/ogr/ogrsf_frmts/xodr/

Configure the paths for all required Windows dependencies in the provided XODRnmake.opt. Then

nmake -f makefile.vc MSVC_VER=1900 WIN64=1 plugin-install

This also copies the required Xerces DLL into GDAL's binary install directory!

3 Testing the OGR OpenDRIVE Driver

If everything went right the built GDAL/OGR is extended by our OpenDRIVE driver and can be tested by running one of the utility programs. Running ogrinfo for the above examples would look like

Linux Windows
cd <gdal>/gdal/build/lib/ cd <gdal>/gdal/build/bin/
../bin/ogrinfo --formats ogrinfo.exe --formats

This should yield the an OGR driver list extended by the new OpenDRIVE driver. To convert an OpenDRIVE XML file into, e.g., an ESRI Shapefile, use the provided utility ogr2ogr:

ogr2ogr -f "ESRI Shapefile" CulDeSac.shp CulDeSac.xodr

OpenDRIVE datasets for testing can be found in the official OpenDRIVE download section. For advanced debug console output of those utility programs and the implemented drivers add CPL_DEBUG=ON to your running environment.

General Development Notes

To easily add new drivers to GDAL as shared libraries GDAL provides the GDALDriverManager with its AutoLoadDrivers() function. The FileGDB driver serves as good orientation for shared library development in GDAL/OGR, see RegisterOGRFileGDB() in FGdbDriver.cpp. Also consider the FileGDB Building Notes.

About

GDAL is an open source X/MIT licensed translator library for raster and vector geospatial data formats. This is a mirror of the GDAL Subversion repository.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 66.3%
  • Python 14.3%
  • C 13.6%
  • HTML 2.8%
  • Java 0.9%
  • Shell 0.6%
  • Other 1.5%