kml is not displayed - google-maps-api-3

I'm writing an application with the google API that loads a kml file from my local server.
But the file is not displayed and the map "moves" to an unspecified location.
To test this i'm just trying the kml example from the google API reference:
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no">
<meta charset="utf-8">
<title>Google Maps JavaScript API v3 Example: KmlLayer KML</title>
<link href="http://code.google.com/apis/maps/documentation/javascript/examples/default.css" rel="stylesheet" type="text/css" />
<script src="http://maps.googleapis.com/maps/api/js?key=AIzaSyAWcYJaMe2mN1u2NYz4ztmffINxGcEpB64&sensor=false&language=he"></script>
<script>
function initialize() {
var chicago = new google.maps.LatLng(41.875696,-87.624207);
var mapOptions = {
zoom: 11,
center: chicago,
mapTypeId: google.maps.MapTypeId.ROADMAP
}
var map = new google.maps.Map(document.getElementById('map_canvas'), mapOptions);
//var ctaLayer = new google.maps.KmlLayer('http://gmaps-samples.googlecode.com/svn/trunk/ggeoxml/cta.kml');
var ctaLayer = new google.maps.KmlLayer('http://www.pgl.co.il/maps/testlyr/cta.kml');
ctaLayer.setMap(map);
}
</script>
</head>
<body onload="initialize()">
<div id="map_canvas"></div>
</body>
</html>
when the file is located in the Google server it works fine, but when the file is in my server (windows, iis 5.1) the html runs but the map does not display the kml file.
I've defined the mime type in the header section of the iis.
What's wrong?
thanks for your help!

The file can't be accessed by Google's servers.
If I put the URL in your code into Google Maps, it says:
File not found at http://www.pgl.co.il/maps/t....
Suggestions:
Make sure the URL is spelled correctly.
Make sure the file exists.
As does http://www.feedvalidator.org:
Server returned timed out [help]
Sorry
An error occurred while trying to validate this feed.
Possible causes:
The address may be incorrect. Make sure the address is spelled correctly. Try loading the feed directly in your browser to make sure a feed exists at that address.
The feed may be temporarily unavailable. The server may be down, or too slow. Try again later.
The validator may be busted. If the feed exists, the server is fine, and the problem is reproducible, let us know on the feedvalidator-users mailing list.
Are you sure that:
Your server is configured to serve kml files
The file is in the right place

Related

Using Meteor + React, how to add script to head tag?

I need to add a script tag to my site but I cannot get it to work.
The instructions say to add to the head tag of the site but I am using Meteor + React and there are no html pages are head tag to add it too.
In the meteor tutorial it says
Meteor parses all of the HTML files in your app folder and identifies three top-level tags: <head>, <body>, and <template>.
Everything inside any <head> tags is added to the head section of the HTML sent to the client, and everything inside <body> tags is added to the body section, just like in a regular HTML file.
So I added a html file in the client directory and added the script tag inside head tag and it does not work. Meteor does not pickup any changes to html files in my project. It is as if the html file does not exist.
I tried using jquery getScript to add the script once the main layout component did mount but that did not work either.
I had the same problem a while back. I was able to load it in componentDidMount in a high level Component.
componentDidMount () {
function loadScript() {
var script= document.createElement('script');
script.type= 'text/javascript';
script.src= 'yourURLhere.js';
script.async = true;
document.body.appendChild(script);
}
loadScript();
}
You can also use
react-helmet.
Sample code:
<Helmet>
<meta charSet="utf-8" />
<title>My Title</title>
</Helmet>
Results in:
<head>
<meta charSet="utf-8" />
<title>My Title</title>
</head>

meteor how to render script tags to include full domain name

I am using meteor with blaze.
Currently in the rendered templates, the scripts files are included as
src="/packages/underscore.js?46eaedbdeb6e71c82af1b16f51c7da4127d6f285"
src="/packages/meteor.js?9730f4ff059088b3f7f14c0672d155218a1802d4"
Is there anyway to change that to include the fully qualified domain name, such as: http://exmaple.com//packages/underscore.js?46eaedbdeb6e71c82af1b16f51c7da4127d6f285
any help will be appreciated!
Yes, I have seen this done. You can make a package and include templating in your api.use. Then, you create an HTML file.
Package.onUse(function (api) {
// ...
api.use('templating', 'client');
api.addFiles('client.html', 'client');
});
In the html file, you can include a <head> tag with a <script> to your resource
<head>
<script src="http://someresource.com"></script>
</head>
For reference, check out the repo for mrgalaxy:stripe, which is required to include a resource linked from Stripe's site.

Does WebMango support uploading DICOM images?

I am confused about uploading new DICOM images to webMango. I was able to do it in the desktop version, but I am unable to do it in webMango? Is it possible using WebMango to view a DICOM image? OR not?
Is it always that I have to provide the params ?
Kindly advice.
Thank you
Yes, you can view DICOM images in webMango. You configure it similar to Papaya, except that you need to put double-quotes around the parameter values. (Also note the images array contains another array of DICOM series URLs.) Here's an example:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>webMango</title>
<script src="mango.js"></script>
<script src="https://www.java.com/js/deployJava.js"></script>
<script>
var params = [];
params["images"] = "[['data/volume/brain_001.dcm', 'data/volume/brain_002.dcm', 'data/volume/brain_003.dcm']]";
params["atlas"] = "data/Talairach.xml";
</script>
</head>
<body>
<p>This is an example use of webMango.</p>
<div style="width:800px;" class="mango"></div>
</body>
</html>
webMango cannot see the local filesystem. So you can only load files via URL references in the params variable. I think it would be technically possible to allow it to see the local filesystem (at least on some platforms), but browsers have been dropping support for Java applets in recent years, putting up more and more hurdles. I'd recommend Papaya over webMango in most cases.

Google API map path not showing

Following the official guide:
https://developers.google.com/maps/documentation/javascript/examples/layer-kml
I did exactly the same thing. I jave that specific kml file on my site, and I create a page with that exact html+javascript code (copy-paste, no errors). The path for the kml file is correct too.
Of course, I inserted the right API KEY obtained by google.
Running the page, the maps shows up, in the correct start position and with the correct zoom, but I can't see any path.
How is possible?
I have only one hint: in Netbeans, I get this warning on the var map:
The global variable "google" is not declared.
I can't figure it out.
Thank you for any help!
EDIT: That's my javascript as asked (it's just copy-paste from that site):
function initMap() {
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 11,
center: {lat: 41.876, lng: -87.624}
});
var ctaLayer = new google.maps.KmlLayer({
url: 'MYURL/cta.kml',
map: map
});
}
'MYURL' is the url of the file, that is correct (already tested). The cta.kml file is the one from that site, saved and uploaded on mine. The complete file URL is working, and the file itself has attribute 644 (publicly available) on my FTP.
Have you added this code in order to include Google's library?
<script src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&callback=initMap" async defer></script>
Try to check for network status of this library file, in your browser devtools.

How to Properly Setup an Exit/Panic Button with Multiple Redirects

I have a site that that I've built that is for a Women's Shelter, and it requires the 'exit button' or 'panic button'.. many sites just exit you to Google or another friendly site.. I see a few questions on here that solve the problem in one way or another, but this one my client is most interested in:
http://www.ncadv.org/
Can someone tell me how they're doing this? When you click on the 'safety exit' button, it redirects a BUNCH of times to different sites (thus filling the history quickly with other friendly sites).. I really like this approach, I just can't figure how they're doing it. Any ideas? I'd thought originally they were directing to sites that have their own redirect pages set up, but if you copy the initial link in a new window, it only redirects one time.
Probably via HTTP Referer. To test, run the following in command line:
curl --header "Referer: http://www.ncadv.org/" http://abconlinenews.info/localnews.php
The link, http://abconlinenews.info/localnews.php is the first outgoing link on the button.
The response (when passed an HTTP referer with ncadv.org) is:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
<META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<title>ABCNews.com: Daily News, Breaking News and Video Broadcasts - ABC News</title>
<script>
function trigger() {
setTimeout("setPage();",20);
}
function setPage() {
window.location="/localnewstoday.php";
}
</script>
</head>
<body onload="trigger();">
<h1>Not Found</h1>
<p>The requested URL was not found on this server.</p>
<hr>
<address>Apache/2.2.16 (Debian) Server at http://abconlinenews.info Port 80</address>
</body>
</html>
From there, it's probably referers and redirects all the way down ;)
One thing you might consider is using javascript to keep the history clear. If you use "location.replace('www.google.com');" for example, it will replace the current entry with the new url and there won't be a history entry to go back to.
If you used a function and passed urls to it via onClick events, you could eliminate any history from being tracked at all.

Resources