1

I am looking at a piece of work to deploy QGIS as the standard within an organisation. There is an existing piece of software that I need to link to QGIS so that when a button is pressed within the app, it opens QGIS, opens a given project and pans to the correct location (using coordinates in the application).

If I were to call QGIS from commandline, what would I need to a) open a given project and b) how would I pass coordinates from one system to automate the map window pan to location.

I'm guessing that it is going to be some python code? That being the case, are there any examples of similar ways of starting QGIS?

Thanks

1

1 Answer 1

5

You should be able to do this (in a slightly modified form) with just command line options.

From http://docs.qgis.org/2.0/html/en/docs/user_manual/introduction/getting_started.html

Command line option --project

Starting QGIS with an existing project file is also possible. Just add the command line option --project followed by your project name and QGIS will open with all layers loaded described in the given file.

Command line option --extent

To start with a specific map extent use this option. You need to add the bounding box of your extent in the following order separated by a comma:

--extent xmin,ymin,xmax,ymax

So if you can convert your "target coordinates" to an extent (which probably makes sense anyway - it allows you to make a centre location and a zoom level) then you may not need any code on the QGIS side. Just build a command line and call QGIS with that.

1
  • Thanks @BradHards - just the answer I was looking for (can't you tell I'm a total noob at this :-))
    – Mark
    Commented Apr 26, 2013 at 7:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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