Shapefiles play a crucial role in BI by providing a geospatial foundation for data analysis. These files, comprising geometric and attribute information, enable businesses to integrate location-based data seamlessly into their analytical workflows. Recognizing the importance of location-based information, Snowflake allows users to store, query, and analyze geospatial data. How to load geospatial data that is in a shapefile into a Snowflake table?
Some previous steps before starting the challenge:
- Download shapefile as a .zip archive from here: https://mapcruzin.com/free-italy-arcgis-maps-shapefiles.htm#google_vignette (feel free to choose any other type of shapefile from any other platform, I really like trains so I chose this one🚆).
- Open this file. You can do it online here: https://mapshaper.org/. Below is a screenshot of the picked file opened by Mapshaper.
At this point, let the challenge begin:
- Load the .zip file into a Snowflake stage. (There are at least three ways to do that!).
- Find out how to convert the shapefile into a Snowflake table with geospatial features.
- Review the results (as in the picture below).
Can’t wait to see your ideas!
mferle says
Had to google this one, fortunately a Medium blog came up with the solution 🙂
Atzmonky says
I took a different approach and converted the shp file to WKT using GDAL/OGR library.
Then I uploaded the CSV/WKT to a stage and inserted the data to a table using to_geography() to finish it up to the final format.