Re: [Qgis-developer] QGIS remote control API

2017-03-15 Thread Luigi Pirelli
On 15 March 2017 at 10:10, Barry Rowlingson
 wrote:
> Yes, it wouldn't be a good idea for every plugin that wanted to do
> some sort of remote control to implement its own server. Perhaps there
> should be a server plugin that plugins can hook into at a given URL,
> so they can attach a handler function to http://host:port/wherever

but you can design your plugin to be used by other plugins and with a
"plugin" structure...
e.g. a lot o people use Processings algs thanks of ther interface
offered by the processing  plugin.

btw these are my 2c

Luigi Pirelli

**
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS 2nd Edition:
* 
https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
**
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS remote control API

2017-03-15 Thread Barry Rowlingson
On Tue, Mar 14, 2017 at 10:29 PM, Luigi Pirelli  wrote:
> you can already open a project from command line, so what you need is
> only to create project template, use it and start qgis on this
> project btw if you want a more sophisticated bridge to have
> control on qgis, you can simply run a plugin that start a python
> simple http server (as in RemoteControl plugin) at which to send your
> commands. The plugin listener will dispatch the correct execution to
> qgis (it would make sense to have a plugin with commands as plugins ;)

Yes, it wouldn't be a good idea for every plugin that wanted to do
some sort of remote control to implement its own server. Perhaps there
should be a server plugin that plugins can hook into at a given URL,
so they can attach a handler function to http://host:port/wherever

> expanding your idea the plugin can setup a webrtc client that receive
> pushed stream data from a relay server => e.g. IoT devices sending
> data streams I did a proof of concept just to test and works, it's
> just few line of code... most of the code would be what to do with
> these commands or data stream.

 I'd be interested to see those few lines since I've not played with webrtc.

> IMHO it's not necessary to have it as a core feature

Totally agree. It would get minority usage and is implementable in
plugins, so no need to have core dev involvement and support. They've
enough to do!

Barry

> cheers
>
> Luigi Pirelli
>
> **
> * Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
> * LinkedIn: https://www.linkedin.com/in/luigipirelli
> * Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
> * GitHub: https://github.com/luipir
> * Mastering QGIS 2nd Edition:
> * 
> https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
> **
>
>
> On 14 March 2017 at 18:51, Barry Rowlingson
>  wrote:
>> I'm doing some spatial analysis with R. I've read in a shapefile:
>>
>>  > data = shapefile("input.shp")
>>
>> then I've done some analysis:
>>
>>  > data$stats = something(data)
>>
>> Now I want to map it. I can use R's plot function, but that's not
>> interactive, hard to add background layers and style, no labelling,
>> cartography etc. I could use leaflet, but that requires JS code to get
>> anything custom. So I write a shapefile:
>>
>>  > shapefile(data, "output.shp")
>>
>> Start QGIS, load the shapefile, realise all my column names have been
>> mashed to 12 characters (or whatever), style it. Go "huh" and think.
>> Back to R. Repeat.
>>
>> With a QGIS remote control API I could do something like:
>>
>>  > addQgisLayer(data)
>>
>> and *bang* there it is in Qgis. With data flow in that direction, Qgis
>> is a cartographic display for R's spatial data. But data flow could go
>> the other way - so that Qgis layers could be easily read back into R
>> spatial data.
>>
>>  In theory you could wrap the entire Python API to the remote control
>> API. At that point the use cases are almost like any Python QGIS use
>> cases, except expanded to any language or system that can send a web
>> request. R, Matlab,  JS, perl, ruby.. even Python if you want to be
>> slightly perverse and can't run from the python interpreter.
>>
>> Barry
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Tue, Mar 14, 2017 at 3:35 PM, Tom Chadwin  wrote:
>>> What are some example use cases?
>>>
>>> Tom
>>>
>>>
>>>
>>> -
>>> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
>>> --
>>> View this message in context: 
>>> http://osgeo-org.1560.x6.nabble.com/QGIS-remote-control-API-tp5312091p5312279.html
>>> Sent from the QGIS - Developer mailing list archive at Nabble.com.
>>> ___
>>> Qgis-developer mailing list
>>> Qgis-developer@lists.osgeo.org
>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> ___
>> Qgis-developer mailing list
>> Qgis-developer@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS remote control API

2017-03-14 Thread Luigi Pirelli
you can already open a project from command line, so what you need is
only to create project template, use it and start qgis on this
project btw if you want a more sophisticated bridge to have
control on qgis, you can simply run a plugin that start a python
simple http server (as in RemoteControl plugin) at which to send your
commands. The plugin listener will dispatch the correct execution to
qgis (it would make sense to have a plugin with commands as plugins ;)

expanding your idea the plugin can setup a webrtc client that receive
pushed stream data from a relay server => e.g. IoT devices sending
data streams I did a proof of concept just to test and works, it's
just few line of code... most of the code would be what to do with
these commands or data stream.

IMHO it's not necessary to have it as a core feature

cheers

Luigi Pirelli

**
* Boundless QGIS Support/Development: lpirelli AT boundlessgeo DOT com
* LinkedIn: https://www.linkedin.com/in/luigipirelli
* Stackexchange: http://gis.stackexchange.com/users/19667/luigi-pirelli
* GitHub: https://github.com/luipir
* Mastering QGIS 2nd Edition:
* 
https://www.packtpub.com/big-data-and-business-intelligence/mastering-qgis-second-edition
**


On 14 March 2017 at 18:51, Barry Rowlingson
 wrote:
> I'm doing some spatial analysis with R. I've read in a shapefile:
>
>  > data = shapefile("input.shp")
>
> then I've done some analysis:
>
>  > data$stats = something(data)
>
> Now I want to map it. I can use R's plot function, but that's not
> interactive, hard to add background layers and style, no labelling,
> cartography etc. I could use leaflet, but that requires JS code to get
> anything custom. So I write a shapefile:
>
>  > shapefile(data, "output.shp")
>
> Start QGIS, load the shapefile, realise all my column names have been
> mashed to 12 characters (or whatever), style it. Go "huh" and think.
> Back to R. Repeat.
>
> With a QGIS remote control API I could do something like:
>
>  > addQgisLayer(data)
>
> and *bang* there it is in Qgis. With data flow in that direction, Qgis
> is a cartographic display for R's spatial data. But data flow could go
> the other way - so that Qgis layers could be easily read back into R
> spatial data.
>
>  In theory you could wrap the entire Python API to the remote control
> API. At that point the use cases are almost like any Python QGIS use
> cases, except expanded to any language or system that can send a web
> request. R, Matlab,  JS, perl, ruby.. even Python if you want to be
> slightly perverse and can't run from the python interpreter.
>
> Barry
>
>
>
>
>
>
>
>
>
>
>
>
> On Tue, Mar 14, 2017 at 3:35 PM, Tom Chadwin  wrote:
>> What are some example use cases?
>>
>> Tom
>>
>>
>>
>> -
>> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
>> --
>> View this message in context: 
>> http://osgeo-org.1560.x6.nabble.com/QGIS-remote-control-API-tp5312091p5312279.html
>> Sent from the QGIS - Developer mailing list archive at Nabble.com.
>> ___
>> Qgis-developer mailing list
>> Qgis-developer@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS remote control API

2017-03-14 Thread Enrico Ferreguti
I never tested, but I see there is https://github.com/3liz/qgis-wps4server
a server-plugin to perform remote geoprocessing jobs.
Anyway I think this could be very handy for remote qgis-server
administration.

Regards.
Enrico

2017-03-14 21:48 GMT+01:00 Bernd Vogelgesang :

> Hi Barry,
> sounds great for me! (simple users opinion)
>
> Cheers
> Bernd
>
>
> Am 14.03.2017, 18:51 Uhr, schrieb Barry Rowlingson <
> b.rowling...@lancaster.ac.uk>:
>
> I'm doing some spatial analysis with R. I've read in a shapefile:
>>
>>  > data = shapefile("input.shp")
>>
>> then I've done some analysis:
>>
>>  > data$stats = something(data)
>>
>> Now I want to map it. I can use R's plot function, but that's not
>> interactive, hard to add background layers and style, no labelling,
>> cartography etc. I could use leaflet, but that requires JS code to get
>> anything custom. So I write a shapefile:
>>
>>  > shapefile(data, "output.shp")
>>
>> Start QGIS, load the shapefile, realise all my column names have been
>> mashed to 12 characters (or whatever), style it. Go "huh" and think.
>> Back to R. Repeat.
>>
>> With a QGIS remote control API I could do something like:
>>
>>  > addQgisLayer(data)
>>
>> and *bang* there it is in Qgis. With data flow in that direction, Qgis
>> is a cartographic display for R's spatial data. But data flow could go
>> the other way - so that Qgis layers could be easily read back into R
>> spatial data.
>>
>>  In theory you could wrap the entire Python API to the remote control
>> API. At that point the use cases are almost like any Python QGIS use
>> cases, except expanded to any language or system that can send a web
>> request. R, Matlab,  JS, perl, ruby.. even Python if you want to be
>> slightly perverse and can't run from the python interpreter.
>>
>> Barry
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> On Tue, Mar 14, 2017 at 3:35 PM, Tom Chadwin 
>> wrote:
>>
>>> What are some example use cases?
>>>
>>> Tom
>>>
>>>
>>>
>>> -
>>> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
>>> --
>>> View this message in context: http://osgeo-org.1560.x6.nabbl
>>> e.com/QGIS-remote-control-API-tp5312091p5312279.html
>>> Sent from the QGIS - Developer mailing list archive at Nabble.com.
>>> ___
>>> Qgis-developer mailing list
>>> Qgis-developer@lists.osgeo.org
>>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>>
>> ___
>> Qgis-developer mailing list
>> Qgis-developer@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>>
>
>
> --
> Bernd Vogelgesang
> Siedlerstraße 2
> 91083 Baiersdorf/Igelsdorf
> Tel: 09133-825374
>
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS remote control API

2017-03-14 Thread Bernd Vogelgesang

Hi Barry,
sounds great for me! (simple users opinion)

Cheers
Bernd

Am 14.03.2017, 18:51 Uhr, schrieb Barry Rowlingson  
:



I'm doing some spatial analysis with R. I've read in a shapefile:

 > data = shapefile("input.shp")

then I've done some analysis:

 > data$stats = something(data)

Now I want to map it. I can use R's plot function, but that's not
interactive, hard to add background layers and style, no labelling,
cartography etc. I could use leaflet, but that requires JS code to get
anything custom. So I write a shapefile:

 > shapefile(data, "output.shp")

Start QGIS, load the shapefile, realise all my column names have been
mashed to 12 characters (or whatever), style it. Go "huh" and think.
Back to R. Repeat.

With a QGIS remote control API I could do something like:

 > addQgisLayer(data)

and *bang* there it is in Qgis. With data flow in that direction, Qgis
is a cartographic display for R's spatial data. But data flow could go
the other way - so that Qgis layers could be easily read back into R
spatial data.

 In theory you could wrap the entire Python API to the remote control
API. At that point the use cases are almost like any Python QGIS use
cases, except expanded to any language or system that can send a web
request. R, Matlab,  JS, perl, ruby.. even Python if you want to be
slightly perverse and can't run from the python interpreter.

Barry












On Tue, Mar 14, 2017 at 3:35 PM, Tom Chadwin   
wrote:

What are some example use cases?

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
--
View this message in context:  
http://osgeo-org.1560.x6.nabble.com/QGIS-remote-control-API-tp5312091p5312279.html

Sent from the QGIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer



--
Bernd Vogelgesang
Siedlerstraße 2
91083 Baiersdorf/Igelsdorf
Tel: 09133-825374
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS remote control API

2017-03-14 Thread Tom Chadwin
We had a QGIS plugin developed for the planning system we use.You start to
add a planning application into it, then you press the plot button, and QGIS
starts with certain layers open. You plot the app, then press a plugin
button, and you are sent back to the planning software, with the polygon
associated with the new planning record. I don't know how it does all that,
but the process can certainly start outside QGIS.

As I say, I don't know how it does all this, but it does beg the question of
how much of this can already be done. 



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/QGIS-remote-control-API-tp5312091p5312316.html
Sent from the QGIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS remote control API

2017-03-14 Thread Barry Rowlingson
I'm doing some spatial analysis with R. I've read in a shapefile:

 > data = shapefile("input.shp")

then I've done some analysis:

 > data$stats = something(data)

Now I want to map it. I can use R's plot function, but that's not
interactive, hard to add background layers and style, no labelling,
cartography etc. I could use leaflet, but that requires JS code to get
anything custom. So I write a shapefile:

 > shapefile(data, "output.shp")

Start QGIS, load the shapefile, realise all my column names have been
mashed to 12 characters (or whatever), style it. Go "huh" and think.
Back to R. Repeat.

With a QGIS remote control API I could do something like:

 > addQgisLayer(data)

and *bang* there it is in Qgis. With data flow in that direction, Qgis
is a cartographic display for R's spatial data. But data flow could go
the other way - so that Qgis layers could be easily read back into R
spatial data.

 In theory you could wrap the entire Python API to the remote control
API. At that point the use cases are almost like any Python QGIS use
cases, except expanded to any language or system that can send a web
request. R, Matlab,  JS, perl, ruby.. even Python if you want to be
slightly perverse and can't run from the python interpreter.

Barry












On Tue, Mar 14, 2017 at 3:35 PM, Tom Chadwin  wrote:
> What are some example use cases?
>
> Tom
>
>
>
> -
> Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon
> --
> View this message in context: 
> http://osgeo-org.1560.x6.nabble.com/QGIS-remote-control-API-tp5312091p5312279.html
> Sent from the QGIS - Developer mailing list archive at Nabble.com.
> ___
> Qgis-developer mailing list
> Qgis-developer@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

Re: [Qgis-developer] QGIS remote control API

2017-03-14 Thread Tom Chadwin
What are some example use cases?

Tom



-
Buy Pie Spy: Adventures in British pastry 2010-11 on Amazon 
--
View this message in context: 
http://osgeo-org.1560.x6.nabble.com/QGIS-remote-control-API-tp5312091p5312279.html
Sent from the QGIS - Developer mailing list archive at Nabble.com.
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer

[Qgis-developer] QGIS remote control API

2017-03-13 Thread Barry Rowlingson
My first job was in integrating spatial statistics and GIS. In those
days (1990) that meant Arc/Info version 4 and FORTRAN, until we
discovered S-Plus and ditched Arc/Info for real statistics software.

Twenty six years on and still thinking about integration. Some of you
may have seen my very sketchy R package that starts up a map canvas
and layer list and then lets R users add map data to the canvas. It
works via a libpython interpreter loaded into R and then making PyQGIS
API calls. My GSoC 2017 proposal is basically improving and extending
that.

But I've leant towards a slightly different idea - remote control of a
QGIS instance. There exists already a QgsRemoteControl plugin which is
intended to keep two QGIS instances in sync with respect to projection
and extent etc. But what I'd like to do is have an HTTP API that could
also add and modify data layers to a running QGIS, potentially from
any client.

So once set up, you could do:

 wget http://localhost:17919/zoom?extent=...

 wget --post-file=map.json http://localhost:17919/addlayer

and so on. Then any "mapping deficient" programming language or system
could then have a client written for that API and use whatever
functionality is exposed by it.

 I've already got a basic HTTP server that runs in Qgis and accepts
requests, and it uses the Qt event system so is totally non-blocking
(except when actually processing a request).

 Is this a good idea/useful idea/dumb idea? I can rewrite my GSoC to
more reflect this idea if its thought useful. I have been contacted by
a possible student with an interest.

Barry
___
Qgis-developer mailing list
Qgis-developer@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer