-
Notifications
You must be signed in to change notification settings - Fork 2
Uploading a shapefile to the GeoServer
-
Once you have saved the file in shapefile format, upload it to the server's myshapefile folder using the following command in a terminal on your local machine:
scp <path_to_local_file> globaled@globaleducationobservatory.org:/home/globaled/myshapefileAn example would be:scp /Users/heatherbaier/Desktop/test/slv.zip globaled@globaleducationobservatory.org:/home/globaled/myshapefile -
Log into the server and change into the myshapefile directory
ssh globaled@globaleducationobservatory.org
cd myshapefile
-
Unzip the zipfile you just uploaded:
unzip <zip_file_name> -d <new_folder_to_extract_to>An example would be:unzip slv.zip -d slv -
Delete the zipfile
rm slv.zip -
Switch into the new folder you just extract to
cd slv -
Upload the file to the PostGIS database using the shp2pgsql command:
shp2pgsql -s 4326 <ISO> <ISO> | psql -d globaled_geoAn example would be:shp2pgsql -s 4326 slv slv | psql -d globaled_geoThis command will halt until you enter the password and then it will upload the file. It is doen when it prints the message: "ANALYZE" -
Log into the GeoServer at globaleducationobservatory.org/geoserver. Get the username and password from Heather and login.
-
In the Data section on the left-hand sidebar, click on 'Layers'
-
Choose 'Add new layer"
-
In the dropdown labeled 'Add a layer from' choose 'geo:GEO_PostGIS'
-
Next to the layer name you just uploaded, click 'Publish'
-
In the 'Data' tab, scroll down to the 'Bounding Boxes' section and click on 'Compute from native bounds' under 'Lat/Lon Bounding Box'. Two boxes will populate with bounding box information.
-
Scroll backup and under the 'Publishing' tab click on the dropdown labeled 'Default Style' and select 'geo:school' (you have to scroll up a bit in the dropdown to find it)
-
At the bottom of the screen, click on 'Save'. The file is snow fully loaded!
-
To double check everything looks okay, go to 'Layer Preview' under the 'Data' section int he left-hand sidebar. Next to the layer you just uploaded, click on 'OpenLayers'. The map should render in a new tab!