cityjson / cjio

CityJSON/io: Python CLI to process and manipulate CityJSON files
MIT License
119 stars 31 forks source link

Allow cjio to read accessible web stored json data #136

Open RitaAguiarAdsk opened 2 years ago

RitaAguiarAdsk commented 2 years ago

I would like it to be possible to load a json file from a link url with cityjson.load(path) For example, I want to load this file, but I don't want to download it, I want to read it directly from the web: https://s3.dualstack.us-east-1.amazonaws.com/opencitymodel/2019-jun/json/NewYork/36061/NewYork-36061-000.json

Refer to this discussion for more information: https://github.com/cityjson/specs/discussions/114

balazsdukai commented 2 years ago

Just for clarification, a fix for this would still download the whole file at once, however the downloading and loading would be handled automatically by cjio. The whole citymodel would be loaded in one go. You wouldn't need a separate download + cityjson.load() step.

Or do you mean to stream the citymodel, loading cityobjects one-by-one as you request them?

RitaAguiarAdsk commented 2 years ago

I think the first option you have suggested is certainly enough for what I would like to do. I am not going to stream this information but rather extract just the building's information I need. My use case is: I have a polygon boundary of an area in the world, in this case NYC, and I want to find all the building objects in that polygon. All json files with this info are stored online (I'm using OpenCityModel for this) and I want to read them and only extract the building objects I need by saving them in a json file on my local computer. I do not wish to download any of those OpenCityModel json files, but if there is no other option, then I will download them and keep them temporarily.

balazsdukai commented 2 years ago

For now it is not possible to do this in cjio, but it's a useful feature and most likely it will be added.