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.

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

share|improve this question
1  
Much simpler than I thought (d.oh), using this link anitagraser.com/2010/11/30/… –  Mark Apr 26 '13 at 7:35
add comment

1 Answer

up vote 5 down vote accepted

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.

share|improve this answer
    
Thanks @BradHards - just the answer I was looking for (can't you tell I'm a total noob at this :-)) –  Mark Apr 26 '13 at 7:41
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.