Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Offline in local-directory #3

Open
LaermTot opened this issue May 10, 2017 · 2 comments
Open

Offline in local-directory #3

LaermTot opened this issue May 10, 2017 · 2 comments

Comments

@LaermTot
Copy link

Hello

I tried using your demo locally by modifying the source a bit

var idx = location.pathname.lastIndexOf("index.html");
var loc = location.origin+location.pathname;
if (idx > 0)
  loc = location.origin+location.pathname.substring(0,idx);

var style = {
  "version": 8,
  "sources": {
    "countries": {
      "type": "vector",
      "tiles": [loc+"/countries/{z}/{x}/{y}.pbf"],
      "maxzoom": 6
    }
  },
  "glyphs": loc+"font/{fontstack}/{range}.pbf",
  "layers": [{

the Problem was, that ocation.origin+location.pathname created a String like

file:///var/foo/bar/somewhere/index.html ..

The Problem that I'm having tight now, is the fact that I simply get a Page with all the Navigation-Widgets but no map is being displayd ..

Any hints what I'm doing wrong ?

.....

@bean-fidhleir
Copy link

Yes, you have to replace the location.* with the absolute path root. I've no idea where the location.* vars are defined, but "index.html" is not the identifier of a subtree! Which means it can't be allowed in the middle of the path.

@hjrobinson
Copy link

I can't get the index.html to display my the vector tiles generated from mbutil. The pbf files are in the folder called parcels_tiles. Is there a particular usage for a mbitles.pbf file (generated from mbutil) in this case? Here is a sample of my code:

var style = {
"version": 8,
"sources": {
"tax_parcels": {
"type": "vector",
"tiles": ["file:///C:/parcels_tiles/{z}/{x}/{y}.pbf"],
}
},
{
"id": "tax_parcels",
"type": "line",
"source":"gig_harbor_parcels",
"source-layer":"gig_harbor_parcels",
"paint": {
"line-color": "#bada55"
}
},

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants