-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes and new raw files parser #4
Conversation
KML Parser: - Added MultiGeometry Support - Added Check for existance of <Document> Tag jinja Handler: - Fixed: "COLOR:" appearing on the previous line instead of on the next line while rendering Buffer for text - Fixed: "TEXT:" appearing on the previous line instead of on the next line - Fixed: "COORDPOLY:" not appearing after every polygon while rendering Polygons for TopSky Maps New raw file parser: - Added the ability to load not only one raw file, but the whole directory
For contributions in the future, please separate each logical change by commit so it can be reviewed and merged individually. At least one PR per topic would be excellent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR in itself is very hard to review and test because it touches lots of different places and there is no good test cases. We should add unit tests at some point to mapbuilder. I would love to see smaller changes that are easier to merge individually.
Do you have a repo where you are using your changes? I'm wondering if you are in fact using the mapbuilder correctly. Since there is no documentation at the moment, I do understand that some of our design choices might be confusing.
else: | ||
parser = RAWParser(source_dir / config["data"][data_source]["source"]) | ||
self.data[data_source] = parser.parse() | ||
#logging.debug(self.data[data_source]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Either remove debugging statements or leave them in if they provide any benefit.
result[Path(*filepath.parts[1:]).as_posix()] = f.read() | ||
elif os.path.isdir(root / dirname): | ||
#logging.debug(f"2: {dirname}") | ||
self.parse_recursively(root / dirname, result) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the use case for this? Why is a single file und thus raw string per data item not enough?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well, in FIR Langen they used an own script, to paste some data into maps. It worked simply by finding .import and replacing it with txt files in the path. I know mapbuilder can import plain txt files, but I would need to get every single of these 100 txt files into mapbuilder.toml. I found it would be simpler if I could make the mapbuilder to search for the needed txt files by itself by parsing the whole directory with all these txt files and then in jinja provide a path to the file inside given directory. I couldn't just paste the data into maps, because I it was actually reused in completely separate maps for separate profiles.
@@ -97,6 +98,9 @@ def to_text_buffer(geometry, label: str, color: str, adapt_to_length=True): | |||
|
|||
_render_polygon(lines, [buffer], color) | |||
|
|||
for i in range(len(lines)): | |||
lines[i] = lines[i].replace("COLOR", "\nCOLOR") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like the wrong position to fix this. Are you sure you are using the Jinja templating language correctly?
@@ -107,7 +111,7 @@ def to_text(geometry, label: str): | |||
return "" | |||
|
|||
labeltext, _, _ = label.partition("#") | |||
return f"TEXT:{coord2es(point.coords[0])}:{labeltext}" | |||
return f"TEXT:{coord2es(point.coords[0])}:{labeltext}\n" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here. Newlines should be handled by Jinja templates.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I will try to replicate the issues with newlines one more time and will send a result.
Do you mean the repo with already made maps? I do have it here: https://github.com/sergej-singer/edgg-package |
I'm really sorry for that, I am quite new to this and not an actual programmer. Should I close then this PR and open new ones with smaller changes per issue? |
Thanks for the contribution, but with multiple issues mangled into one commit, and not all of the fixes being correct, this cannot be merged like this. |
KML Parser:
<Document>
Tag, resolves No Tag <Document> in KML File #3jinja Handler:
COLOR:
appearing on the previous line instead of on the next line while rendering Buffer for textTEXT:
appearing on the previous line instead of on the next lineCOORDPOLY:
not appearing after every polygon while rendering Polygons for TopSky Maps, resolves Wrong generation of Polygons for TopSky Maps #2New raw file parser: