whosonfirst / go-whosonfirst-exportify

Tools (written in Go) for exporting Who's On First records.
BSD 3-Clause "New" or "Revised" License
0 stars 1 forks source link

Convert ESRI Shapefile to WhosOnFirst SQLite #12

Open bdmapman opened 2 months ago

bdmapman commented 2 months ago

I am using Pelias for a long time and for this I am using the WhosOnFirst SQLite DB provided by https://geocode.earth. I observed that download page there are a lot of format in which the WhosOnFirst data is being provided. Shapefile is one of them. I have downloded the shapefile and saw its properties as well as the SQLite.

Now I need to use my own custom data for the WhosOnFirst SQLite DB. I have created all my required shapefiles absolutely similar to the shapefiles provided by the WhosOnFirst. Now I need to convert these shapefiles to SQLite. I think there is no tool to directly convert the shapefiles to SQLite. This should be done by creating GeoJSON. I have export all of my shapefiles to GeoJSON.

I want to know is the go-whosonfirst-exportify the right tool to convert GeoJSON files to SQLite which have the appropriate format to support in the Pelias?

An example command will be very helpful.

Thanks

thisisaaronland commented 2 months ago

Adding @missinglink to the thread.

I don't think that wof-exportify is the right place for this for two reasons:

1) It is slowly being superseded by the whosonfirst/wof-cli package so I am hesitant to add more functionality right now. 2) What really needs to happen is for a Pelias-Shapefile specific implementation of the whosonfirst/go-whosonfirst-iterate interfaces needs to be written.

The code in (2) would need to generate GeoJSON Feature data that could be consumed by the whosonfirst/go-whosonfirst-sqlite-features-index package, keeping in mind that the Shapefiles are abbreviated WOF data and won't contain all the data necessary to index all the SQLite tables.

I will add that to the "to do" list although I can't give you a realistic estimation of when I can get it done right now.

missinglink commented 2 months ago

Hi @bdmapman, the shapefiles we provide were intended as a read-only view of the data, the intention was to make the data more accessible to desktop GIS software.

That said, we didn't consider the inverse operation.

However, it would be possible to go the other way to create sqlite/geojson from a shapefiles, this code doesn't exist today.

If you'd like a list of which shapefiles fields are mapped from which part of the geojson document, this file is what we're using: https://github.com/pelias/wof/blob/master/whosonfirst/view/shapefile.js