Vector Fail

2479
13
02-18-2016 07:22 AM
BrianO_keefe
Occasional Contributor III

So I'm trying to play with the Vector Sample in the API and it doesn't work.

https://developers.arcgis.com/javascript/jssamples/layers_vector.html

I copied the sandbox example to my server.

http://maps.cityoftulsa.org/jsdev/vector/index.html

Then I copied the root.json contents to my own file.

http://maps.cityoftulsa.org/jsdev/vector/style/root.json

I made a single adjustment (background color) to see if my changes would propagate and I get a 404 error.

I know the file is there. I have both copied and renamed it from the server directly. It's there. The contents match exactly with what I am trying to do. Still nothing. I will happily admit I am clueless as to vector styling via JSON, so maybe I'm doing something simple and ignorant of basic concepts. But I can't figure it out.

I even copied and pasted the original JSON back into it and still I get a 404. Confused.

Tags (3)
0 Kudos
13 Replies
RobertScheitlin__GISP
MVP Emeritus

Brain,

   For some reason the third link to the root.json is not reachable and this is the first issue you have. The next issue will be that unless you updated the ../sprites/sprite url and the glyphs path ../fonts/{fontstack}/{range}.pbf to point to the new local version of your root.json you will get 404 errors on those file. And even after you do that you will get 403 (access forbidden) errors when it tries to reach those sprite.json and png files as you now have the requests coming from different domain and now need a proxy.

BrianO_keefe
Occasional Contributor III

And see, Robert that is where my confusion comes in. I can't even access that root.json file directly from within. I'm uncertain of how it can be blocked or what is blocking it and I'm not sure where to look to find out that information.

Like Chris Smith​ said, I have not checked the json MIME type on the server. I assume it works because of all of the other activity we have going on through it but I'm not certain.

What would you suggest to check the link availability?

0 Kudos
ReneRubalcava
Frequent Contributor

I would follow the instructions Chris posted to add the json MIME type to IIS. I'd bet that is the issue you are having with the 404s.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Brain,

   If you can not just type this url: http://maps.cityoftulsa.org/jsdev/vector/style/root.json into your browser and have it return the json then you may want to follow the links Chris provided to setup the json handler on your web server. But as I mentioned to Chris this is a mute point as you can not locally host the root.json file as it will result in 403 access denied errors.

0 Kudos
BrianO_keefe
Occasional Contributor III

Yeah, I wasn't able to do that. Now I can.

Now I'm getting a 403 error and this appears to be as you stated... a cross domain or proxy issue.

0 Kudos
ChrisSmith7
Frequent Contributor

Are you sure your web server has a MIME type entry for .json? If it doesn't, it wont know how to serve it up, hence the 404.

0 Kudos
ChrisSmith7
Frequent Contributor

Here's how to do this if you're using IIS:

add .json handler support in IIS 7 | uipress.com

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Chris,

   None of that matters if the requests to url like http://basemaps.arcgis.com/arcgis/rest/services/World_Basemap/VectorTileServer/sprites/sprite.json is denied due to it coming from a unauthorized domain like his because he copied the root.json to his own server.

0 Kudos
BrianO_keefe
Occasional Contributor III

Ok. I added the json MIME type and I get some progress. It looks like the problem is as Robert Scheitlin, GISP​ said.

So this is a cross-domain issue? Or a proxy?

0 Kudos