Subscribe to this thread
Home - General / All posts - M9 Exporting a drawing from a manifold server script
danb

2,064 post(s)
#18-Apr-23 05:00

I have been tinkering with the Manifold server as I was hoping to be able to run the server on a paid license but initially at least, use the free viewer as a client. This works well and I was able to work up a proof-of-concept tool very quickly for a particular task.

What I really want to be able to do now however is to generate a drawing result on the server and get the server to export it to a drive on our internal network. The version returned to the viewer client is just used for checking the results.

In my test setup (attached) was attempting to export a “result” drawing directly from the SQL being run of the server using some code posted in this thread (SQL EXPORT (georeference.org)). Though the code seems to run however, no feature is exported.

Does anyone know if this is possible to do? I thought it might work as the server is running on a paid license of Manifold and the export is being written to a local network location.

Any thoughts appreciated as ever.

Instructions:

Save the project to a local drive and set the @EXPTPATH parameter in [USER EXPORT PARAMETERS] to a folder that exists on the target drive.

Serve the project through localhost e.g .

Open a CMD window.

Change the directory to that of your Manifold executable.

Fire up the server using something along the lines of: manifoldsrv -addr:localhost -workers:16 "C:\TEST.map"

In a new Manifold session make a connection to the server using localhost as the server.

Open the Server database link and run the query [EXPORT SQL] this should export the [TILES] drawing as a shapefile but doesn’t.

Is this possible?

Attachments:
TEST.map


Landsystems Ltd ... Know your land | www.landsystems.co.nz

Dimitri


7,413 post(s)
#18-Apr-23 07:01

I haven't taken a look at your project, but there's an exporting example that's in the Manifold Commander topic in the user manual you might find helpful. Commander is in both Universal and Server licenses.

adamw


10,447 post(s)
#15-May-23 15:02

I checked and the script fails because Application.GetDatabaseRoot() returns nothing. We'll make the server publish its database so that the call above can locate it.

Thanks a lot for the file that contains everything needed to reproduce the issue, and for the detailed explanation.

Word of advice though: be very careful with putting scripts that access the file system of the server into the served MAP file. Right now, the user can EXECUTE ... your query passing arbitrary parameters, the EXECUTE will pass the query to the server, the server will run it and the query (through the script) will try to write to the passed location. At the very least, design the functions in such a way that one cannot really control the path, only the filename.

danb

2,064 post(s)
#16-May-23 00:09

Thanks so much for looking into this and for making the change such that it should work in future builds.

Your warning is noted regards access to the file system of the server. For what I have in mind to do here, I should be good, but I will be much more careful for anything going out the door.


Landsystems Ltd ... Know your land | www.landsystems.co.nz

Manifold User Community Use Agreement Copyright (C) 2007-2021 Manifold Software Limited. All rights reserved.