Hi Richard,
On 19.10.20 15:17, Richard Duivenvoorde wrote:
Just checking :-)
https://www.lfu.bayern.de/gdi/wfs/natur/oefk
which returns:
Error occurred while processing request
Type: Status Report
Message:
Description: http.400:
*ArcGIS Server*
So apperently ArcGIS Server, no wonder they have to ask money for everything,
they need the money for all the licenses ;-)
Yep, they are completely in the hands of offrippers. The company with
the contract for the software to collect and process ecological data has
this contract till the 80s ... and that's what the software and its
functionality looks alike.
Anyway, this WMS layer was just one example where I could need to
extract the infos so I could match them with the cadastre and other
units for further processing. And maybe I could write those guys a
postcard, asking them to send me the data.
But there are many more examples where my approach would be very helpful
for a lot people around here.
I thought you wanted to create some PyQGIS script for it.
The reason this seems not to work (yet), is that QGIS is a c++ program with
python bindings for almost everything, but not everything.
I think devs could make my example work, but there was no use case for it yet...
If there was a python script for something similar, I may be able to
tweak it to my needs, eventually, some day ...
But... if your are not into Python, what would be your preferred scripting
language be then?
I am an (low-to-medium-profile) R guy ;) Doesn't care about indentions
and other crazy stuff ;)
Dived into it during the times when the graphical modeler was breaking
my models with every new version (besides the missing functions)
Given a WMS getMap request like:
https://www.lfu.bayern.de/gdi/wms/natur/oefk?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetMap&BBOX=5330491.995354886167,3656773.878684170544,5332123.064803482033,3661911.927476988174&CRS=EPSG:31467&WIDTH=1428&HEIGHT=453&LAYERS=oekoflaechen&STYLES=&FORMAT=image/jpeg&DPI=96&MAP_RESOLUTION=96&FORMAT_OPTIONS=dpi:96
You would end up to create GetFeatureInfo requests like this to return in html:
https://www.lfu.bayern.de/gdi/wms/natur/oefk?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&BBOX=5330491.99535488616675138,3656773.87868417054414749,5332123.06480348203331232,3661911.92747698817402124&CRS=EPSG:31467&WIDTH=1427&HEIGHT=453&LAYERS=oekoflaechen&STYLES=&FORMAT=image/jpeg&QUERY_LAYERS=oekoflaechen&INFO_FORMAT=text/html&I=544&J=361&FEATURE_COUNT=10
Or in plain/text (VERY ugly formatted!):
https://www.lfu.bayern.de/gdi/wms/natur/oefk?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetFeatureInfo&BBOX=5330491.99535488616675138,3656773.87868417054414749,5332123.06480348203331232,3661911.92747698817402124&CRS=EPSG:31467&WIDTH=1427&HEIGHT=453&LAYERS=oekoflaechen&STYLES=&FORMAT=image/jpeg&QUERY_LAYERS=oekoflaechen&INFO_FORMAT=text/plain&I=544&J=361&FEATURE_COUNT=10
So theoretically you could create some script to just fire the
GetFeatureInfo-requests. Main drawback is for a request to be valid, your bbox
and width/height should be in par with your x,y (mmm, ArcGis apparently uses I
J, which are pixels! in the bbox/width/height)... So I think that is pretty
difficult.
So my conclusion, not as easy as you hoped I think, best would be to just get
the data from somewhere, not sure if hacking your code will be easier...
but it
- would be 'easiest' in PyQGIS (because the 'indentify' is easier to script,
because you can use QGIS magic to determine bbox/width and height params)
- or recreate valid getfeatureinforequests and fire those in some other script
language
Looking that the result in QGIS, there is not so much info in it, just 4
fields.... one of them the area.
Yep, and still enough info for me to work on.
Regards,
Richard Duivenvoorde
Anyway, thanx for your attention and time
Bernd
On 10/19/20 2:45 PM, Bernd Vogelgesang wrote:
Hi Richard,
your last question first: Nope, there is definitely no WFS (would be too easy). I am
living in Bavaria, the home of "Laptop and Lederhosen". Our administrations are
among the greediest and most retarded (offering hardly any WFS which then mostly have to
paid as well) in Germany.
How would I know this is a Geoserver instance? The url of the WMS is
|https://www.lfu.bayern.de/gdi/wms/natur/oefk?|
My "python" is actually nonexistant, so I was hoping that there was something "prebuilt"
in someone's drawer already. But as my web research showed, there does seem to be much on this topic besides
of "not possible".
It's a bit mystical to me why QGIS can show the result of a click on a layer,
but not store the data by any means ...
Mhm ...
Bernd
On 19.10.20 14:07, Richard Duivenvoorde wrote:
Hi Jorge, Bernd,
I thought to play with that, but ...
although I get a valid result, I cannot get to the actual features in python:
TypeError: unable to convert a C++ 'QgsFeatureStoreList' instance to a Python
object
So I'm not sure if you could (currently) easily come to the actual feature...
What I did (working with a national buildings WMS, and a (to me) known valid
x,y,width/height etc:
l=qgis.utils.iface.addRasterLayer(
"crs=EPSG:28992&layers=Bebouwingvlak&styles=&format=image/png&url=https://geodata.nationaalgeoregister.nl/kadastralekaart/wms/v4_0?",
# uri
"buildings", # name for layer (as seen in QGIS)
"wms" # dataprovider key
)
result = l.dataProvider().identify( QgsPointXY(104606,490213),
QgsRaster.IdentifyFormatFeature,
QgsRectangle(104391.1406077263819,490161.0749502293766,104899.6563292678911,490283.3410253541078),
1465,
352,
96)
print(result.isValid()) # prints True
print(result.results())
# prints TypeError: unable to convert a C++ 'QgsFeatureStoreList' instance to a
Python object
Regards,
Richard Duivenvoorde
PS @Bernd: you are sure there is no WFS running there (if it is a Geoserver
instance, it often has (silently) also a WFS....)?
On 10/19/20 1:36 PM, Jorge Gustavo Rocha wrote:
Hi Bernd,
Try rlayer.dataProvider().identify()
Checks the docs at
https://docs.qgis.org/3.10/en/docs/pyqgis_developer_cookbook/raster.html#query-values
Good luck,
Jorge
Às 12:25 de 19/10/20, Bernd Vogelgesang escreveu:
Hi there,
unfortunately I am provided with data only in form of a WMS layer
representing areas as polygons.
These areas match with the cadastral boundaries.
I am looking for a way how to hand over the data from the WMS to my
cadastral units to be able to really work with these informations.
I created a "Point on surface" layer of the cadastre.
Is there any pythonic or other way to "mimic" the "Identify features"
click on that layer with the coordinates of those points and store the
results?
I assume, that each click is a server request, so running these (in my
case) 8000 "cĺicks" should not be sent in a millisecond, but with some
pause.
It doesn't really matter how long this takes, cause it only has to be
done once and would be in any case faster than manually clicking and
noting the data.
Obviously, this is not what the provider of the data intends, but it's
like an act of self-defence against a stubborn and bureaucratic
administration.
So, data rebels, come to help please ;)
Cheers,
Bernd
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
--
Email Signature
Logo <https://www.geomaster.pt>
*Geomaster*
*Jorge Gustavo Rocha* | Software Engineer
*e:*j...@geomaster.pt | *m:*+351 910 333 888
*g:*41.54094,-8.40490 | *v: *510 906 109
*a: * Rua António Cândido Pinto, 67, 4715-400 Braga
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
_______________________________________________
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user