homaily / Saudi-Arabia-Regions-Cities-and-Districts

Saudi Arabia Regions, Cities and Districts
GNU General Public License v2.0
298 stars 197 forks source link

Generating a file that holds regions, cities, and districts within one file #16

Closed yazeed44 closed 2 years ago

yazeed44 commented 3 years ago

Hello @homaily

As of now, regions, cities and districts are separated into their own files. This is great when integrating with relational databases since we can import those files into their own tables, and have them reference each other when needed. But with non-relational databases, it is encouraged to embed instead of reference.

This pull request is for generating a json and geojson that holds regions, and within each region an array of cities are held, and within each city an array of districts. A json file of this structure should integrate with a non-relational DB easily.

I have also made a number of other changes

homaily commented 3 years ago

Hi @yazeed44,

Thanks for the PR. As far as I know GeoJSON supports multiple layers, so it's possible to import different files into one map. It's counter productive to repeat same data again.

I would love to hear back from you if I'm missing something. Otherwise, seems like a special case to me.

Thanks for the hard work, I appreciate the time and effort you put to contribute to this project.

Cheers

yazeed44 commented 3 years ago

I think it's better to have a single geojson that contains all the geometries just in case the user is using a viewer that does not support multiple layers. But as you said, this is rather a special case and most users will not encounter it.

Maybe we can delete embedded_regions.geojson, and if the user for some special case needed to have it, they can generate it using generate_geojson.py from embedded_regions.json?

Thanks for the hard work, I appreciate the time and effort you put to contribute to this project.

Glad to help :+1: