djangorestframework-mvt icon indicating copy to clipboard operation
djangorestframework-mvt copied to clipboard

I can't set the url with args (from django path), such as Martin tile server

Open mdtrooper opened this issue 4 years ago • 2 comments

Code Sample, a copy-pastable example if possible

For example:

urlpatterns.append(path("garden/<z>/<x>/<y>.pbf", mvt_view_factory(Garden)))

Problem description

I worked with Martin tile server and they has the standard ": <url>/{schema_name}.{table_name}/{z}/{x}/{y}.pbf

And your url is:

<url>/api/v1/data/example.mvt?tile=1/0/0

Expected Output

A vector tile.

Version Number

from requirements.txt:

Django==3.0.10 djangorestframework==3.11.1 djangorestframework-mvt==0.2.4

And python version (from Dockerfile):

FROM python:3.8

mdtrooper avatar Oct 30 '20 11:10 mdtrooper

I stumbled upon the same... Most vector tile servers seems to have z,x,y in url path (not in query). IMO this would be more consistent

henhuy avatar Nov 17 '20 12:11 henhuy

I think this is because djangorestframework-mvt uses django-rest-framework-gis's get_filter_bbox to generate the bbox and it only supports query_params. I have a forked branch of django-rest-framework-gis and a pull request for djangorestframework-mvt that does a pretty ham fisted job but works.

I suspect a better solution would be replicating get_filter_bbox in djangorestframework-mvt but would be nice to get some feedback before i try that.

ioionu avatar Feb 21 '21 10:02 ioionu