Changing syntax of WMTS Source to XYZ Layer - leaflet

I am looking to add a WMTS source in my Leaflet application.
To do this, I pull up the XML file of WMTS source and extract the variables I need to create the syntax for XYZ Layer URL.
The XYZ Layer can then be loaded into Leaflet &/or QGIS.
Example (WORKING):
https://tiles.arcgis.com/tiles/NkcnS0qk4w2wasOJ/arcgis/rest/services/OrthoImagery2019/MapServer/WMTS/1.0.0/WMTSCapabilities.xml?cacheKey=886383ae702b176e
Would change to (WORKING):
https://tiles.arcgis.com/tiles/NkcnS0qk4w2wasOJ/arcgis/rest/services/OrthoImagery2019/MapServer/WMTS/tile/1.0.0/OrthoImagery2019/default/default028mm/{z}/{y}/{x}.png
Example (NOT WORKING):
https://web2.co.ottertail.mn.us/arcgis/rest/services/Photography/2021_Photo/MapServer/WMTS/1.0.0/WMTSCapabilities.xml
Would change to (NOT WORKING):
https://web2.co.ottertail.mn.us/arcgis/rest/services/Photography/2021_Photo/MapServer/WMTS/tile/1.0.0/Photography_2021_Photo/default/default028mm/{z}/{y}/{x}.png
CRS of source is EPSG: 3857 so I do not believe this to be the issue.
Can someone assist? Thank you!

Related

PyQGIS: change expression for datadefined symbology

I have a QGIS project that displays calculation results on a map. There are several vector layers, each with >100 calculated fields. The way the data should be visualised is very similar for all these layers/fields. I try to write a script that duplicates a template layer, and changes the expressions for the symbology according to the selected fieldname.
Below is a screenshot of the properties I try to access (if I were to change them using the UI).
How do I access/change the expressions of the line width and line offset of a graduated symbology in PyQGIS?
In case someone else runs into this issue.
I solved it using a workaround. I saved the style of the source layer to a qml-file, for the duplicated layers I create a temporary copy of the qml-file, do a search-and-replace on the qml-file and apply this to the new layer using
newLayer.loadNamedStyle(pathToTheTempQmlFile)
Hope this helps:
rule=layer.renderer().rootRule().children()[0]
rule.setFilterExpression('whatever')
see:
QgsRuleBasedRenderer.Rule

How do I use OSM custom tags in Mapbox style

Here's a brief description of what I'd like to do (and I'm very, very new to this but seem to have hit a wall):
Display a map of color-coded buildings based on a custom tag (miamioh_lds).
What I've tried: in Mapbox Studio Classic starting with the Emerald style (coordinates 84.7286, 39.5033)
#building [miamioh_lds="uitcp"] {
polygon-fill: #f61313;
}
I would expect Hoyt Hall to be red, but it is not, even if I remove all other #building CartoCSS statements.
I would like the building filled, which is why I'm using tags and fill instead of using a data source, which seems to be focused at adding markers. I'm using Mapbox because my goal is to bring the map into Tableau (which I'll use to add a marker off dynamic data, which is why I need a fill, not a marker here).
Can I use custom tags in CartoCSS? If so, what am I doing wrong?
Thanks!

Open a Mapbox map in QGis

I'm looking for a way to display one of my Mapbox map in QGis (baselayer edited on mapbox.com & data uploaded from tilemill).
Did someone here already find a way ? Is there a feature or a plugin to do that ?
Thanks for your future answers !
Adrien
Yesterday, I found two solutions by myself :
1) the pretty official "TileLayer Plugin" QGis plugin
You'll have to write a TSV file (Tab Separated Values) with, at least, the name, the credits and the URL of your Mapbox map. The URL should look like :
http://a.tiles.mapbox.com/v3/mapboxId.mapId/{z}/{x}/{y}.png
You just have to replace mapboxId and mapId with your ids. See the github repository of the plugin for further informations and values to add to your TSV file (minZoom, maxZoom, etc).
Then, in the "settings" menu of the plugin, link the plugin to the directory of your TSV file ("external layers directory").
Finally, in the "add" menu of the plugin, select your map and click "add".
2) a XML file which is interpreted as a raster
Write a XML file with this code :
<GDAL_WMS>
<Service name="TMS">
<ServerUrl>http://a.tiles.mapbox.com/v3/mapboxId.mapId/${z}/${x}/${y}.png</ServerUrl>
</Service>
<DataWindow>
<UpperLeftX>-20037508.34</UpperLeftX>
<UpperLeftY>20037508.34</UpperLeftY>
<LowerRightX>20037508.34</LowerRightX>
<LowerRightY>-20037508.34</LowerRightY>
<TileLevel>18</TileLevel>
<TileCountX>1</TileCountX>
<TileCountY>1</TileCountY>
<YOrigin>top</YOrigin>
</DataWindow>
<Projection>EPSG:3857</Projection>
<BlockSizeX>256</BlockSizeX>
<BlockSizeY>256</BlockSizeY>
<BandsCount>3</BandsCount>
<Cache />
</GDAL_WMS>
Once again, replace the ids with yours. Then, open the file in QGis as a raster.

Remove street numbers from OSM maps

I'm still working on my map project. I use mapnik tools to render my own maps.
Mapnik reads a xml file to style each tiles.
At this moment, i managed to remove street names and all stuff that was useless for my project. The only problem i have is about removing the street numbers, which still appear even when all useless layers are off.
I give you a pastebin link to my xml file: http://pastebin.com/ZRtmYBRz.
Do you know how i can remove the street numbers ? Thanks.
Before :
Now:
Try using a filter on the addr:housenumber tag of the nodes in the source file that contain that info. Once you get those, you can change the rendering by using a TextSymbolizer.
More info on https://github.com/mapnik/mapnik/wiki/TextSymbolizer

Unity3d and CityEngine

I created a small city in CityEngine using the openstreetmap data (osm file), where I've the latitude, longitude and some others details of each node. Now I want to export this information to the Unity3d, so I exported the city as fbx file. At this point everything is going ok.
The problem is ... in cityEngine each block/shape represents a different object, however in unity3d this is not happen. The data is divided per texture (or something like that). But I need to recognize each block/shape or at least I need to know the right position of them.
You have a option in the exporter where you can export the scene as centered around the xyz origin (exporter options).
The exporter has many settings for mesh-granularity. The meshes are per default merged by material. But you can of course also export for each shape one object etc.
Please visit the CityEngine Forum for more info:
http://forums.arcgis.com/forums/45-Solutions
http://forums.arcgis.com/threads/51437-Export-Mesh-and-Material-Granularity?highlight=cityengine+unity