Skip to content

Uploads geojson files to Socrata using standard API calls

Notifications You must be signed in to change notification settings

DataSF/Geojson-to-Socrata

Repository files navigation

Geojson-to-Socrata

Takes geojson files and uploads them to socrata via standard REST API calls

There wasn't a good way to programatically upload geojson files to Socrata. This is a work-around. Uses the standard sodapy replace and upsert methods.

####This script also contains support to receive email reports to let you know if the upload succeeded or failed and log exceptions that the script encounters at runtime.

Steps to use this work around:

  1. Take the first line of your geojson file like this: head -n3 geoJsonFile.json > geoJsonFileHeader.json and then add ]} to your file stuff to make your json valid.

  2. Manually create a new geo dataset in socrata. When it asks for a file, upload your geoJsonFileHeader.json file. No need to upload the entire file; all you need is one record so that you can create the attribute schema for the geodata set.

  3. Once the geodata dataset is created, grab the 4x4 for the layer (important to note- the dataset 4x4 and the layer 4x4 are two separate things. You want the layer 4x4 as you will be upserting to this). Stick the layer 4x4 for the dataset into the script's configuration file, fieldconfig.yaml

  4. Fill out the rest of config files ( fieldconfig.yaml, socrata_config.yaml, email_config.yaml) with your own params. Ie your socrata username/pass, your email server, directory configs, etc.

  5. Feel free to email questions to: janine.heiser@sfgov.org

About

Uploads geojson files to Socrata using standard API calls

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages