Skip to content

Instantly share code, notes, and snippets.

@mrcnc
Last active March 20, 2017 21:59
Show Gist options
  • Select an option

  • Save mrcnc/5c7bfb93923091aa7b78a4b9b0930c15 to your computer and use it in GitHub Desktop.

Select an option

Save mrcnc/5c7bfb93923091aa7b78a4b9b0930c15 to your computer and use it in GitHub Desktop.
import remotely hosted geojson into a geogig-backed data store in geoserver
#!/bin/bash
# first initialize a new geogig repo on geoserver
curl -v -u admin:geoserver -X PUT "https://dev.spatialconnect.boundlessgeo.com/geoserver/geogig/repos/my-repo-name/init.json" \
-d '{ "authorName": "My Name", "authorEmail": "myname@boundlessgeo.com" }' \
-H "Content-Type: application/json, charset=utf-8"
# then create a new data store using the geogig repo
curl -v -u admin:geoserver "https://dev.spatialconnect.boundlessgeo.com/geoserver/rest/workspaces/testing/datastores" \
-d "<dataStore><name>my-data-store</name><connectionParameters><entry key=\"geogig_repository\">geoserver://my-repo-name</entry></connectionParameters></dataStore>" \
-H "Content-type: text/xml, charset=utf-8"
# now tell geoserver to import the geojson into the data store
curl -v -u admin:geoserver "https://dev.spatialconnect.boundlessgeo.com/geoserver/rest/imports?async=true&exec=true" \
-d '{
"import": {
"targetWorkspace": {
"workspace": {
"name": "testing"
}
},
"targetStore": {
"dataStore": {
"name": "my-data-store"
}
},
"data": {
"type": "remote",
"location": "https://gist.githubusercontent.com/mrcnc/9d1dc83ed70adb99e3fe4f1e2c41f426/raw/eb540ddfb24ef11a1c0a39145e91f673790bdcb3/bbox.geojson"
}
}
}' \
-H "Content-type: application/json, charset=utf-8"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment