Setting up¶
- Download WinSCP, PuTTY
- Get Key For Authenticating with Server to input to WinSCP and PuTTY
Go to directory of app server¶
Get into the server
Go to directory of app server:
cd ~/mdcorp-docker-compose
Go to web GIS container¶
Get server container name currently running web gis:
source scripts/helpers.sh && production-env --no-input compose ps web
What you need is something like:
mdcorpdockercompose_web_1.Get into the server container (w/o the
<and>:with-docker-env docker exec -it <container_server_name> bash
Go to Rails Console¶
Open up rails console:
cd /app source /scripts/helpers.sh && rails console
Here you will be able to manipulate data.
Retrieving Category¶
Find by name
category = Category.find_by!(name: "Name you want to find")
Find by name under a specific category
parent_category = Category.find_by!(name: "Name of parent") category = Category.find_by!(name: "Name you want to find", parent: parent_category)
Creating a Category¶
Create category
category = Category.create!(parent: parentCategory, name: "Name of new category", visible: true)
Updating a Category¶
Update details
category.name = "new name" category.save!
Deleting a Category¶
Delete
category.delete
Creating new Asset¶
- Upload kml files you need and get into the Rails Console. See
- Find category you want to put the layer and kmls into. See
Create the asset (no kml yet). Depending on if you want to display kml features:
layer = Layer.create!(category: category, name: "Name of new asset", show_kml_description: true, show_feature_area_and_perimeter: true, toggleable: false)You can set these fields as true/false to control behavior:
- show_kml_description - whether or not GIS will show descriptions on KML (attributes)
- show_feature_area_and_perimeter - whether or not GIS will try to compute area/perimeter (required to be polygons)
- toggleable - whether or not GIS will display data like the current Contour Slopes.
- visible - whether or not GIS will display layer
Retrieving Asset¶
Find category where the asset will be added. See Retrieve Category <#retrieving-category>
Find asset
layer = Layer.find_by!(name: "Name of asset you want to retrieve", category: category)
Updating an Asset¶
Update details
layer.name = "new name" layer.show_kml_description = true layer.save!
Adding a new KML¶
Upload KML files via WinSCP using the Key. Please upload to
/tmp/.Copy asset files to asset directory:
sudo cp /tmp/filename.kml ~/mdcorp-docker-compose/systemassetsdata/
Go to web GIS container (Go to web GIS container)
Confirm files are available on
/var/www/public/system:ls -al /var/www/public/system
You should see the filenames of the uploaded files that you need to update.
Find asset needed where you want to upload the KML files (Retrieving Asset)
Add the KML files:
file = File.open('/var/www/public/system/filename.kml') kml_file = KmlFile.new(layer: layer, attachment: file) file.close kml_file.save!
Deleting a KML¶
Find specific KML
KmlFile.where(layer: layer)[0] # first kml KmlFile.where(layer: layer)[1] # second kml KmlFile.where(layer: layer)[2] # third kml KmlFile.where(layer: layer)[3] # fourth kml KmlFile.where(layer: layer)[1].delete # delete second kml
Adding a new Geotechnical Report¶
Upload Geotechnical Report PDF file via WinSCP using the Key. Please upload to
/tmp/.Copy asset files to asset directory:
sudo cp /tmp/filename.pdf ~/mdcorp-docker-compose/systemassetsdata/
Go to web GIS container (Go to web GIS container)
Confirm files are available on
/var/www/public/system:ls -al /var/www/public/system
You should see the filenames of the uploaded file that you need to update.
Find asset needed where you want to upload the pdf file (Retrieving Asset)
Add the KML files:
file = File.open('/var/www/public/system/filename.pdf') kml_file = GeotechnicalReport.new(layer: layer, attachment: file) file.close kml_file.save!
Deleting Geotechnical Report¶
Find specific Geotechnical Report
GeotechnicalReport.where(layer: layer)[1].delete # delete geotechnical report