Using openseamap as an imageryprovider in Cesium - cesiumjs

is there anyway to use openseamap in cesium. the tile map service url: http://t1.openseamap.org/seamark/ gave errors in console such as "http://t1.openseamap.org/seamark/tilemapresource.xml not found" and CoRS error.
Regards
Valimo

Related

Why does the viewer uses developer-dev.api.autodesk.com instead of the developer.api.autodesk.com resulting in invalid tokens?

The viewer v7 uses https://developer-dev.api.autodesk.com/modelderivative/v2/designdata/:urn/manifest instead of https://developer.api.autodesk.com/modelderivative/v2/designdata/:urn/manifest which seems to prevent the viewer from getting the manifest data. The developer-dev host answers with:
{
"developerMessage": "The token has expired or is invalid",
"moreInfo": "https://forge.autodesk.com/en/docs/oauth/v2/developers_guide/error_handling/",
"errorCode": "AUTH-006"
}
The same token works for the developer host just fine.
Does anyone know why the token only works for the developer host or why the viewer uses the developer-dev host instead of the developer host?
The Forge Viewer definitely does not connect to https://developer-dev.api.autodesk.com by default. For example, this basic Forge app is using viewer version 7.*: https://forge-basic-app.herokuapp.com, and it only communicates with https://developer.api.autodesk.com.
Are you perhaps using any custom settings when using the Autodesk.Viewing.Initializer or when instantiating the actual viewer object?

Forge Viewer Error

When I open the viewer I get these errors:
Failed to load https://ase.autodesk.com/adp/v1/analytics/upload: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https://ontargetapp.local' is therefore not allowed access. The response had HTTP status code 503.
2adp-web-analytics-sdk.min.js:4 OPTIONS https://ase.autodesk.com/adp/v1/analytics/upload 503 (Service Unavailable: Back-end server is at capacity)
How do I solve this?
You do not need to solve this - this is an OPTIONS HTTP request which does not need to be honored - It has no impact on the viewer - This is Autodesk an analytics call.
Yes, just add 'useADP:false' to your load options, like this...
var options = {
env: "Local",
useADP: false,
}
Autodesk.Viewing.Initializer( options, function() {
viewer.start(myURN, options, onSuccess);
});
etc
Reference:
https://github.com/wallabyway/markupExt/blob/6c55e73226a70a61f33bc7f8f021b44a979c32e2/docs/app.js#L14
This will turn off analytics and remove the error you are seeing. Hope that helps!
UPDATED

Chrome navigator.geolocation.getCurrentPosition() error 403

For some reason suddenly when calling navigator.geolocation.getCurrentPosition() I get this error:
Network location provider at 'https://www.googleapis.com/' : Returned error code 403.
It used to work perfectly yesterday! Could there be anything with their servers??
It appears it is back up now. But before I realized it was working, I used another way to get location data as recommended by another user on reddit.com
var latLong;
$.getJSON("http://ipinfo.io", function(ipinfo){
console.log("Found location ["+ipinfo.loc+"] by ipinfo.io");
latLong = ipinfo.loc.split(",");
});
Source: https://www.reddit.com/r/webdev/comments/3j8ipj/anyone_else_had_issues_with_the_html5_geolocation/
This happens for me too on idoco.github.io/map-chat
I suspect that this is related the the changes google planed for Deprecating Powerful Features on Insecure Origins it seems that some changes were done in the last few days in this chromium Issue 520765: Deprecation and removal of powerful features on insecure origins
Can you test your site over https to confirm that?
In the meanwhile I found this api usage as a workaround on this repo:
$.getJSON("http://ipinfo.io", function(doc){
var latlong = doc.loc.split(",")
setUserLocation(parseFloat(latlong[0]), parseFloat(latlong[1]));
getLocation(parseFloat(latlong[0]), parseFloat(latlong[1])).then(function(res){
userLocationName = res
})
initialiseEventBus();
map.panTo(userLocation);
}, function(err) {
setUserLocation(Math.random()*50, Math.random()*60);
userLocationName = "unknown.na"
initialiseEventBus();
map.panTo(userLocation);
})
I had the same issue, you have to check your developer dashboard and make sure that your API key has no usage restrictions or warnings.

How to catch a load error with RequireJS when Google Maps times out?

I'm currently using the Async plugin to load Google Maps in our application using RequireJS (https://github.com/millermedeiros/requirejs-plugins):
define("googleMap", ['async!https://maps.googlee.com/maps/api/js?v=3&sensor=false']);
Then include it wherever I need it:
define(['googleMap'], function () { ... });
From China for example, Google Maps is forbidden and it will result with a "Load timeout for modules: async!googleMap". This will also break the entire website as the dependency is not available.
How can I catch that error so the app can run? Then wherever I use googleMap I would check that the object 'google' exists before using it.
I think you can ping the site before you pull your js, just like this answer does:
Is it possible to ping a server from Javascript?

Program-generated KML file validates, but doesn't work

I had a co-worker that normally worked with Google Maps and now I am creating my first map. I am using what they developed in the past and making the changes for what I need. They created a script that sets some of the map defaults, so that is why things might look slightly different.
var map = new Map();
map.loadMap();
var kml = new google.maps.KmlLayer({ url: 'http://api.mankatomn.gov/api/engineeringprojectskml', suppressInfoWindows: true });
kml.setMap(map.map);
The map loads. My KML file doesn't load. I don't get any errors in the console. When I replace the url with a different URL http://www.mankato-mn.gov/Maps/StreetConstruction/streetconstruction.ashx?id=122 it'll work just fine. My new feed does validate. Is there a issue with my web service?
Update: After a few days, I am still having the issue. So I am pretty sure this isn't a DNS issue anymore. I created a jsFiddle to see if it is my code or something else. I started with Google's sample code and changed the URL of the KML file to both my web service and to a static version of the generated file. Both are valid KML files. Neither work. If there was a syntax error, wouldn't the API report that?
You can get the status of a KML layer with
kml.getStatus();
which in this case return:
"INVALID_DOCUMENT"
Now, if I request your URL from the browser, I get
<Error>
<Message>An error has occurred.</Message>
</Error>
So it seems if there ever was a valid KML there, it isn't anymore. Assuming from your question I can oly guess it was above weight limit, or you weren't associating it with a valid instance of map.
For getStatus to return something useful, you must wait for Google Maps API to try and load the KML layer you declared. For example, you can add a listener on the status_changed event.
var kmloptions={
url: 'https://dl.dropboxusercontent.com/u/2732434/engineeringprojectskml.kml',
suppressInfoWindows: true
};
var newKml = new google.maps.KmlLayer(kmloptions);
newKml.setMap(map);
google.maps.event.addListenerOnce(newKml, 'status_changed', function () {
console.log('KML status is', newKml.getStatus());
});
in this case (note that I'm using the alternative URL you used in the jsFiddle), I still get INVALID DOCUMENT.
Update: it seems the problem was the encoding of the file (UTF-16 BE is meant to be binary). I converted it to utf-8 and reindented (it's in my public dropbox now)
You can check if the DNS is setup by:
Going to the url in your browser. Do this with cache emptied and history ereased (private mode is best). If it ends up at your server and the right file it is not a DNS problem.
Move the file to a location you're sure it is reachable without any DNS issues. e.g. http://www.mankato-mn.gov/Maps/StreetConstruction/engineeringprojectskml
If the problem persists make sure that your KML syntax and Javascript is 100% correct. Also check out https://developers.google.com/maps/documentation/javascript/examples/layer-kml if you're still having any issues.