Package nl.tudelft.simulation.dsol.animation.gis.osm

## Class OsmFileCsvParser

- java.lang.Object
- - nl.tudelft.simulation.dsol.animation.gis.osm.OsmFileCsvParser

    public final class OsmFileCsvParser
    extends Object

This class parses a CSV file that defines which elements of an OpenSTreetMap file need to be drawn and what format to use.

Copyright (c) 2020-2022 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See for project information DSOL Manual. The DSOL project is distributed under a three-clause BSD-style license, which can be found at DSOL License.

The dsol-animation-gis project is based on the gisbeans project that has been part of DSOL since 2002, originally by Peter Jacobs and Paul Jacobs.

Author:
  Alexander Verbraeck

### Method Summary

All Methods Static Methods Concrete Methods
`static GisMapInterface` `parseMapFile​(URL csvUrl, URL osmUrl, String mapName)` Parses a CSV file with information about the map and layers.
`static GisMapInterface` `parseMapFile​(URL csvUrl, URL osmUrl, String mapName, CoordinateTransform coordinateTransform)` Parses a CSV file with information about the map and layers.
`static GisMapInterface` `parseMapFile​(URL csvUrl, URL osmUrl, String mapName, CoordinateTransform coordinateTransform, char fieldSeparator, char quoteCharacter)` Parses a CSV file with information about the map and layers.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

### Method Detail

#### parseMapFile

    public static GisMapInterface parseMapFile​(URL csvUrl,
                                               URL osmUrl,
                                               String mapName)
                                        throws IOException

Parses a CSV file with information about the map and layers.

Parameters:
  `csvUrl` - URL; the url of the CSV file.
  `osmUrl` - URL; the OpenStreetMap file in pbf, osm.gz or osm.bz2 format
  `mapName` - String; the human readable name of the map
Returns:
  MapInterface the parsed map file.
Throws:
  `IOException` - on failure

#### parseMapFile

    public static GisMapInterface parseMapFile​(URL csvUrl,
                                               URL osmUrl,
                                               String mapName,
                                               CoordinateTransform coordinateTransform)
                                        throws IOException

Parses a CSV file with information about the map and layers.

Parameters:
  `csvUrl` - URL; the url of the CSV file.
  `osmUrl` - URL; the OpenStreetMap file in pbf, osm.gz or osm.bz2 format
  `mapName` - String; the human readable name of the map
  `coordinateTransform` - CoordinateTransform; the transformation of (x, y) coordinates to (x', y') coordinates.
Returns:
  MapInterface the parsed map file.
Throws:
  `IOException` - on failure

#### parseMapFile

    public static GisMapInterface parseMapFile​(URL csvUrl,
                                               URL osmUrl,
                                               String mapName,
                                               CoordinateTransform coordinateTransform,
                                               char fieldSeparator,
                                               char quoteCharacter)
                                        throws IOException

Parses a CSV file with information about the map and layers. FieldSeparateor can be, for instance \t for a tab character, and the quote character can be the double quote, the single quote, or something else.

Parameters:
  `csvUrl` - URL; the url of the CSV file.
  `osmUrl` - URL; the OpenStreetMap file in pbf, osm.gz or osm.bz2 format
  `mapName` - String; the human readable name of the map
  `coordinateTransform` - CoordinateTransform; the transformation of (x, y) coordinates to (x', y') coordinates.
  `fieldSeparator` - char; field separator, e.g., comma for csv files and tab for tsv files
  `quoteCharacter` - char; e.g., single or double quote
Returns:
  MapInterface the parsed map file.
Throws:
  `IOException` - on failure reading the CSV file, the shape files, or making the layers
  `IllegalArgumentException` - when one of the outline or fill colors can not be parsed
  `NumberFormatException` - when one of colors contains an illegal number