0

I want to add a custom TileLayer to QGIS that doesn't use only x and y coordinate.

Here is a link to a custom tile:

http://link_to_wms:8080/rest/services/some_service/export?dpi=96&transparent=true&format=png8&layers=show%3A0&bbox=3977.981201590248%2C4252.094193626508%2C12477.737784436798%2C14061.079227260492&bboxSR=%7B%22wkt%22%3A%22PROJCS%5B%5C%22Moscow_bessel%5C%22%2CGEOGCS%5B%5C%22GCS_Bessel_1841%5C%22%2CDATUM%5B%5C%22D_Bessel_1841%5C%22%2CSPHEROID%5B%5C%22Bessel_1841%5C%22%2C6377397.155%2C299.1528128%5D%5D%2CPRIMEM%5B%5C%22Greenwich%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Degree%5C%22%2C0.0174532925199433%5D%5D%2CPROJECTION%5B%5C%22Transverse_Mercator%5C%22%5D%2CPARAMETER%5B%5C%22False_Easting%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22False_Northing%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22Central_Meridian%5C%22%2C37.5%5D%2CPARAMETER%5B%5C%22Scale_Factor%5C%22%2C1.0%5D%2CPARAMETER%5B%5C%22Latitude_Of_Origin%5C%22%2C55.66666666666666%5D%2CUNIT%5B%5C%22Meter%5C%22%2C1.0%5D%5D%22%7D&imageSR=%7B%22wkt%22%3A%22PROJCS%5B%5C%22Moscow_bessel%5C%22%2CGEOGCS%5B%5C%22GCS_Bessel_1841%5C%22%2CDATUM%5B%5C%22D_Bessel_1841%5C%22%2CSPHEROID%5B%5C%22Bessel_1841%5C%22%2C6377397.155%2C299.1528128%5D%5D%2CPRIMEM%5B%5C%22Greenwich%5C%22%2C0.0%5D%2CUNIT%5B%5C%22Degree%5C%22%2C0.0174532925199433%5D%5D%2CPROJECTION%5B%5C%22Transverse_Mercator%5C%22%5D%2CPARAMETER%5B%5C%22False_Easting%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22False_Northing%5C%22%2C0.0%5D%2CPARAMETER%5B%5C%22Central_Meridian%5C%22%2C37.5%5D%2CPARAMETER%5B%5C%22Scale_Factor%5C%22%2C1.0%5D%2CPARAMETER%5B%5C%22Latitude_Of_Origin%5C%22%2C55.66666666666666%5D%2CUNIT%5B%5C%22Meter%5C%22%2C1.0%5D%5D%22%7D&size=831%2C959&f=image

According to this I need to use my current map canvas min/max coordinates, i.e. something like

bpx = iface.mapCanvas().extent()
xmin = bpx.xMinimum()
ymin = bpx.yMinimum()
xmax = bpx.xMaximum()
ymax = bpx.yMaximum()

and paste it into bbox attributes. But how end this by creating a new tile layer?

  • I do not understand why you want to add your WMS using Python and not the QGIS user interface. – Jakob Miksch Oct 25 at 7:44
  • @JakobMiksch If it is possible to add wms that has only bbox using qgis interface this method would be preferrable – Pavel Pereverzev Oct 25 at 7:55
  • Sorry, I do not understand the problem. Maybe you can explain a bit more context. – Jakob Miksch Oct 26 at 16:28
  • @JakobMiksch well actually I deal with my task by direct tile download using python, requests and gdal to make tiles georeferenced. However I still would like to know how to make my certain WMS work in QGIS. As far as I know, a connection to WMS requires at least a link to service like http://mt.google.com/vt/lyrs=m&x={x}&y={y}&z={z} where x, y and z - are parameters of coordinates and zoom level I suppose. Service that I need to connect provides only a link with a bbox parameter only like x_min, y_min, x_max and y_max. Just because it's in an ArcGIS Rest Server. – Pavel Pereverzev Oct 27 at 12:54
  • @JakobMiksch So I thought about a possible solution in giving to a bbox parameters coordinates of current qgis extent but it didn't work. – Pavel Pereverzev Oct 27 at 12:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.