Skip to content

Commit

Permalink
preserve possibility to run converter without shp file (#3158)
Browse files Browse the repository at this point in the history
Co-authored-by: Michal Maciejewski <[email protected]>
  • Loading branch information
simei94 and michalmac authored Mar 12, 2024
1 parent 50dfe1a commit 632e5ec
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,15 @@ public static void main(String[] args) {
@Override
public Integer call() throws Exception {

SumoNetworkConverter converter = SumoNetworkConverter.newInstance(input, output, Path.of(shp.getShapeFile()), crs.getInputCRS(), crs.getTargetCRS(), freeSpeedFactor);
// since ShpOptions.getShapeFile() no longer is a path but a string, we have to check if it is defined before creating SumoNetworkConverter to
// preserve the possibility to run the converter without a shp file, otherwise, when calling Path.of(shp.getShapeFile) a NullPointerException is caused -sme0324
Path path = null;

if (shp.isDefined()) {
path = Path.of(shp.getShapeFile());
}

SumoNetworkConverter converter = SumoNetworkConverter.newInstance(input, output, path, crs.getInputCRS(), crs.getTargetCRS(), freeSpeedFactor);

Network network = NetworkUtils.createNetwork();
Lanes lanes = LanesUtils.createLanesContainer();
Expand Down

0 comments on commit 632e5ec

Please sign in to comment.