Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

The main objective for our project is to create a portal website in Drupal. On this website, people must be able to upload their geographical datasets (mostly shape files, but also xml files that include metadata).

This has to be made as easy to use as possible for the users of the website. Secondly, the data has to be shown on a map or different maps depending on the needs of the user. The metadata also needs to be shown appropriately according to which data is shown on the map. Lastly, people should be able to modify their data online. This would make it very advantageous to use, compared to what they are using right now, although it is not mandatory for our project.

Together with the website, there must be a centralized database with all the data that has been uploaded so far. This can be saved into the GeoServer, combined with a PostGIS database.

What we've been thinking about:

  • Create bash scripts to make an automatic process (e.g. write data into database, create layers into GeoServer, ...)
  • Create an own made Drupal module for uploading AND processing the uploaded data into our database. This way the data is automatically processed and shown directly onto the website. (Not sure if that would be possible...)

So our question: What would be the best solution or is there any other solution/system that we should use?

Thanks in advance

EDIT 26/03/2013:

We've now started working on our Drupal module. Basically a new question that rises here is "Is it possible to create GeoServer stores/layers automatically based on PostGIS data in the database itself?" We're thinking about commands to accomplish this, but we're unsure about it.

EDIT 02/04/2013: This code we use to try to create our layer:

$createlayer=("curl -u admin:geoserver -v -XPOST -H 'Content-Type:text/xml' -d $(ls -t -r /var/www/cartaro/sites/default/files/uploads/*.shp | tail -n 1) http://localhost:8082/geoserver/rest/workspaces/cartaro/datastores/$storename/featuretypes");
exec($createlayer);

This is the result from the commandprompt:

* upload completely sent off: 66out of 66 bytes
< HTTP/1.1 500 Internal Server Error
< Transfer-Encoding: chunked
< Server: Jetty(6.1.8)
< 
* Connection #0 to host localhost left intact
* Closing connection #0
 : only whitespace content allowed before start tag and not / (position: START_DOCUMENT seen /... @1:1) 

What are the possible solutions?

share|improve this question
add comment

2 Answers

What Cartaro can do for you out of the box:

  • Support data uploads through the feeds module. This requires that the structure of your data is known and that a corresponding content type has been configured.

  • Store all data in a single PostGIS database.

  • Register all datasets in a single centralized GeoServer instance. All datasets registered in GeoServer can be displayed as map layers or simple lists in Drupal.

  • Define new map layers with only some clicks (However not fully automatic).

  • Display geodata in the map (styled with SLD).

  • Edit geodata through the integrated OpenLayers Editor http://ole.geops.de (changes are live synced to GeoServer).

It seems Cartaro could be a good starting point for your work. As you suggest it would be necessary to add your own modules that can automate some of the tasks that at the moment require human clicks in the Drupal GUI. It is certainly a better idea to write a custom module instead of a bash script. Also display of metadata would need some adaptation.

BTW: The direct upload of geodata into GeoServer without the need of having an associated content type will be a feature of one of the next Cartaro releases. Currently we still face some problems with the authentication in GeoServer that blocks us.

share|improve this answer
    
Hello and thank you for your information Uli Müller. I suppose we'll start thinking of a concept for a selfmade module, although we're not very experienced with this yet. We've also already checked out the OpenLayers editor, but our version was selfmade and thus not synced with GeoServer. It's good to know that it actually is possible to do that! –  Dieter Mar 25 '13 at 11:45
    
Dear Uli Müller, can you have a look at the edit in the original questions possibly? Thanks! –  Dieter Mar 26 '13 at 12:47
    
Regarding storing GeoServer layers in PostGIS: Use PostGIS stores as GeoServer calls them. Cartaro does use them in the background automatically to store all edits directly in the same PostGIS database that is used by GeoServer. –  Augustus Kling Mar 28 '13 at 9:02
    
Alright thanks, we'll surely have a look at it. Right now we're working with the REST api in our creation of the new module (editing the File module for uploading, towards our needs). Right now we're attempting to use shp2pgsql and psql commands into the php code for the module, but we'll see how that works out... Uptil now it doesn't work. –  Dieter Mar 29 '13 at 7:49
add comment

In reply of my own edit 26/03/2013: http://blog.opengeo.org/2012/10/25/adding-layers-to-geoserver-using-the-rest-api/

This guide looks great! Let's hope we can get this to work.

possible solution:

//Get the storename from the inputfield on the upload page
$storename = $_POST['_storename_textfield'];
//convert the shapefile to a pgsql file
$converttosql = ("shp2pgsql -s 4326 -W LATIN1 $(ls -t -r /var/www/cartaro/sites/default/files/uploads/*.shp | tail -n 1) $storename cartaro > $(ls -t -r /var/www/cartaro/sites/default/files/uploads/*.shp | tail -n 1).sql");

//Command for putting the data in the pgsql file in the database
$insertintodatabase = ("psql -d cartaro -f $(ls -t -r /var/www/cartaro/sites/default/files/uploads/*.sql | tail -n 1)");
//execute the commands (commandline)
exec($converttosql);
exec($insertintodatabase);
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.