Skip to content

Commit

Permalink
Merge pull request #249 from geometalab/dev-qgis3
Browse files Browse the repository at this point in the history
Dev qgis3
  • Loading branch information
mnboos authored Aug 7, 2019
2 parents 920c43e + a51c936 commit d8666a2
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ ls -s ./

#### How can I use the server connection feature?

Any vector tile service, implementing the [TileJSON specification](https://github.com/mapbox/tilejson-spec/tree/master/2.2.0) should work.
Any vector tile service, implementing the [TileJSON specification](https://github.com/mapbox/tilejson-spec/tree/master/2.2.0) with the [vector_layers extension](https://github.com/mapbox/tilejson-spec/issues/14) should work.

For the feature to work, you have to create a connection using a URL pointing to the TileJSON of the tile service.

Expand Down
4 changes: 3 additions & 1 deletion metadata.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ about=Plugin which reads vector tiles according to Mapbox' Vector Tiles specific
* OpenMapTiles.com with OSM Bright MB GL style (default)
* Nextzen.org
This Python plugin uses prebuilt C++ binaries for performance reasons.
version=3.0.5
version=3.1.0
author=Martin Boos
[email protected]

Expand All @@ -22,6 +22,8 @@ [email protected]

# Uncomment the following line and add your changelog:
changelog=
---3.1.0---
* OpenInfraMaps added to predefined connections
---3.0.5---
* Bugfix: Layer names from the TileJSON containing characters invalid for a filepath, would lead to an exception.
* Feature: ArcGIS support via TileJSON
Expand Down
11 changes: 6 additions & 5 deletions plugin/style_converter/core/xml_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import uuid
from xml.sax.saxutils import escape

from ...util.log_helper import warn

_join_styles = {None: "round", "bevel": "bevel", "round": "round", "miter": "miter"}

_cap_styles = {None: "round", "butt": "flat", "square": "square", "round": "round"}
Expand Down Expand Up @@ -92,14 +94,13 @@ def _get_labeling_settings(style):

font = _get_value_safe(style, "text-font", ["Arial"])
text_transform = _get_value_safe(style, "text-transform", "").lower()
if text_transform:
if text_transform and text_transform != "none":
if text_transform == "uppercase":
text_transform = "upper"
field_name = f"upper({field_name})"
elif text_transform == "lowercase":
text_transform = "lower"
field_name = f"lower({field_name})"
else:
raise ValueError("Unknown text_transform '{}'".format(text_transform))
field_name = "{transform}({field})".format(transform=text_transform, field=field_name)
warn(f"Style converter: Unknown text_transform '{text_transform}'")

italic_font = 0
if isinstance(font, list):
Expand Down
5 changes: 5 additions & 0 deletions plugin/ui/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ class ConnectionsDialog(QDialog, Ui_DlgConnections):
_MAPZEN = "Mapzen.com (default entry with credits)"
_MAPCAT = "Mapcat.com (default entry with credits)"
_NEXTZEN = "Nextzen.org (default entry with credits)"
_OIM = "OpenInfraMap.org"

_predefined_tilejson_connections = {
_OMT: {
Expand Down Expand Up @@ -112,6 +113,10 @@ class ConnectionsDialog(QDialog, Ui_DlgConnections):
"url": "https://tile.nextzen.org/tilezen/vector/v1/512/all/tilejson.mvt.json?api_key={token}",
"token": "80xAN5o0QuyFrcPVVIieTA",
},
_OIM: {
"name": _OIM,
"url": "https://openinframap.org/map.json"
}
}

_CONNECTIONS_TAB = "selected_connections_tab"
Expand Down
1 change: 1 addition & 0 deletions plugin/util/tile_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ def load_tiles(self, zoom_level, tiles_to_load, max_tiles=None):
if api_key:
load_url += "?api_key={}".format(api_key)
urls.append((load_url, col, row))
debug("Loading: {}", load_url)

self.max_progress_changed.emit(len(urls))
self.message_changed.emit("Getting {} tiles from source...".format(len(urls)))
Expand Down
4 changes: 2 additions & 2 deletions plugin/vt_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ def _unzip(data):
file_content = data
return file_content

def _process_tiles(self, tiles, layer_filter):
def _process_tiles(self, tiles: List[VectorTile], layer_filter):
"""
Creates GeoJSON for all the specified tiles and reports the progress
:param tiles:
Expand Down Expand Up @@ -682,7 +682,7 @@ def _create_named_layer(self, json_src, layer_name, geo_type, zoom_level):
# layer.setAbstract()
return layer

def _add_features_to_feature_collection(self, tile, layer_filter):
def _add_features_to_feature_collection(self, tile: VectorTile, layer_filter: List[str]):
"""
Transforms all features of the specified tile into GeoJSON
* The resulting GeoJSON feature will be applied to the features of the corresponding GeoJSON FeatureCollection
Expand Down

0 comments on commit d8666a2

Please sign in to comment.