Skip to content

Commit

Permalink
set a fake proj_str for builder calls without the proj_str parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
chenchenplus committed Sep 19, 2024
1 parent 3dec069 commit 98cba72
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 2 additions & 0 deletions mosstool/map/_map_util/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

EPS = 1e-4

DEFAULT_PROJ_STR = "+proj=tmerc +lat_0=0.0 +lon_0=-128.0"

LANE_START_ID = 0_0000_0000
ROAD_START_ID = 2_0000_0000
JUNC_START_ID = 3_0000_0000
Expand Down
9 changes: 7 additions & 2 deletions mosstool/map/builder/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import time
from collections import defaultdict
from copy import deepcopy
from math import atan2
from multiprocessing import cpu_count
from typing import (Callable, Dict, List, Literal, Optional, Set, Tuple, Union,
cast)
Expand Down Expand Up @@ -4350,14 +4349,20 @@ def line2nodes(line):
for i in j[k]["nodes"]
]
x, y = [*zip(*xy)]
_header_proj_str = self.proj_str
if _header_proj_str is None:
logging.warning(
f"Empty proj_str provided, projection in header is set as fake projcetion str: {DEFAULT_PROJ_STR}"
)
_header_proj_str = DEFAULT_PROJ_STR
header = {
"name": name,
"date": time.strftime("%a %b %d %H:%M:%S %Y"),
"north": max(y),
"south": min(y),
"west": min(x),
"east": max(x),
"projection": self.proj_str,
"projection": _header_proj_str,
}
logging.info(
f"{len(self.output_lanes)} Lanes {len(self.output_roads)} Roads {len(self.output_junctions)} Juncions"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mosstool"
version = "0.2.37"
version = "0.2.38"
description = "MObility Simulation System toolbox "
authors = ["Jun Zhang <[email protected]>"]
license = "MIT"
Expand Down

0 comments on commit 98cba72

Please sign in to comment.