-
Notifications
You must be signed in to change notification settings - Fork 33
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
TypeError: list indices must be integers or slices, not str #138
Comments
@AdrianKriger which version of cjio are you using? See |
@balazsdukai from the requirements2.txt -> cjio = 0.7.3 # - python CLI to process and manipulate CityJSON files. |
@balazsdukai this is possibly a conda / pip conflict ---on my side. The challenge is Fiona. -> StackExchange. I don't know. Pretty much stuck. |
Ok, it's not clear to me what causes the issue, but if you set the transform object yourself on the citymodel that you've already loaded with Like this:
I know that this is less than self-explanatory and it will change in the future at some point. For now, I recommend to go through these materials if you are using cjio as a library: https://github.com/3DGI/3dbag-workshop-foss4gnl2021 Let me know if this fixes it. |
Thank you for the response @balazsdukai. I did make a mistake with the depth of the The model creates and
I now want to do as you suggest and add the
and
|
Ok, I'm closing this issue then since the original problem is resolved. Disregard what I wrote about the transform. |
@balazsdukai I do not understand what you are saying.
forgive me for doing this here--- |
Yes, vertex transformation is mandatory per cityjson v1.1, but cityjson.save() does not transform the vertices, because it is not implemented. You need to transform (compress) the vertices manually if you are using cityjson as a library. Check the source code of cityjson.compress() to see how compression works. Check the source code of cityjson.save() to see the details of what it does Lines 75 to 95 in 444c696
|
Thank you @balazsdukai. I think I understand. I should go something like: #clean cityjson
cm = cityjson.load(jparams['cjsn_out'])
cm.remove_duplicate_vertices()
cm.remove_orphan_vertices()
cm.j["transform"] = {
"scale": [0.0, 0.0, 0.0],
"translate": [1.0, 1.0, 1.0]},
#save/write
try:
with open(jparams['cjsn_CleanOut'], 'w') as fout:
if indent:
json_str = json.dumps(cm, indent="\t")
else:
json_str = json.dumps(cm, separators=(',',':'))
fout.write(json_str) I will respond with an affirmative / negative when I have an opportunity. |
I really recommend to go through the materials that I mentioned before: https://github.com/3DGI/3dbag-workshop-foss4gnl2021 Long story short, currently there is some disconnect between the CLI and API methods in cjio. So if you use cjio as a library, you need to be aware of this. |
@balazsdukai I am doing something wrong. You have been very patient and generous with me @balazsdukai. Thank you. |
Discussed in cityjson/specs#115
Originally posted by AdrianKriger April 25, 2022
Hi.
In an attempt to be clever; I sought to update some packages which corrupted an environment. Believing it a sign I further took this as an opportunity to reduce the number of dependencies. All going well.
I now have a TypeError I have no idea how to resolve.
I set the
transform
Object to:Could this the fault?
Have I made the same mistake with the depth of the lists in the boundaries; as an earlier discussion?
Minimum-working-example here - your help is appreciated.
The text was updated successfully, but these errors were encountered: