Openlayers Google V3 doesn't load main.js - google-maps-api-3

under some conditions (that only god or google knows), this is not sufficient to provide the js tag...
<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
... in order to load the Google V3 API. I must provide in these cases the following tag that loads the corresponding main.js:
<script type="text/javascript" src=" http://maps.gstatic.com/intl/pt_br/mapfiles/api-3/8/7/main.js"></script>
Because this file doesn't load automatically from the first script.
Do someone already experienced the same behaviour?

Probably that's because you don't specify api-version in script tag. This works fine for me:
<script src="http://maps.google.com/maps/api/js?v=3.5&sensor=false"></script>

Related

HERE Map does not support hi-IN? Language support and mappings?

We are trying to integrate localization into our HERE JS map display. This involves both the map labels and the UI options.
We are using these JS libraries:
<script src="https://js.api.here.com/v3/3.0/mapsjs-core.js" type="text/javascript" charset="utf-8"></script>
<script src="https://js.api.here.com/v3/3.0/mapsjs-service.js" type="text/javascript" charset="utf-8"></script>
<script src="https://js.api.here.com/v3/3.0/mapsjs-ui.js" type="text/javascript" charset="utf-8"></script>
<script src="https://js.api.here.com/v3/3.0/mapsjs-mapevents.js" type="text/javascript" charset="utf-8"></script>
On our website, we are using language codes following the ISO language codes: http://www.lingoes.net/en/translator/langcode.htm
However, when I try to pass in a standard code like "hi-IN" into the defaultLayers creation:
var ui = H.ui.UI.createDefault(hereMap, maptypes, "hi-IN"); // simplified, language code is actually passed in
Looking at the HERE API documentation: https://developer.here.com/api-explorer/maps-js/maps/map-multi-language-support it seems like I'm using the right kind of language code, but I get "Uncaught Error: Locale [hi-IN] is not supported.". Am I misunderstanding something or using something incorrectly? Is there a list of all the Locales are supported?
If it's not supposed, does anyone have recommendations on how to create our own translations for the map labels like "normal" and "satellite"?
Currently "hi-IN" is not supported yet.
About the map labels in UI. Please see below thread in SOF.
The snipped sample code is about creating own UI control.
How do I get a Terrain Map in UI Controls HERE Maps v3.1
I hope this help.

How to load geojson file in asp.net mvc

I have been adding the following files in my cshtml page.
<script src="http://code.highcharts.com/maps/highmaps.js" )"></script>
<script src="https://code.highcharts.com/maps/modules/data.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="https://code.highcharts.com/modules/offline-exporting.js"></script>
<script src="https://code.highcharts.com/maps/modules/drilldown.js"></script>
<script src="~/Content/js/balochistan.geojson"></script>
And the code for higmaps is present on the same page with script tag. Everything is working fine but hte map is not displaying and giving error for geojson file not being loaded.
http://localhost:9090/Content/js/balochistan.geojson net::ERR_ABORTED 404 (Not Found)
Can anyone please helpthat how a geojson file can be loaded properly and how to give static path to it correctly?
the file ends with .geojson can not be loaded like that - as script - because is a json file
Add this file is a set of json data - you need to loaded them on highcharts either with ajax load, either add them as variable at the beginning and connected to the chart.
Resolved:
The problem resolved by doing few steps like:
adding script tags in proper order.
secondly highmaps.js and highcharts.js file conflict with each other when used on the same page.
In order to resolve this issue you have to add
<script src="http://code.highcharts.com/highcharts-more.js"></script>
script tag in addition to highcharts.js and also replace the highmaps.js with:
<script src="//code.highcharts.com/maps/modules/map.js"></script>
like this:
<script src="http://code.highcharts.com/highcharts.js"></script>
<script src="http://code.highcharts.com/highcharts-more.js"></script>
<script src="https://code.highcharts.com/modules/exporting.js"></script>
<script src="//code.highcharts.com/maps/modules/map.js"></script>
This resolved my problem and map is showing now.

Issue on Loading Google Map - SensorNotRequired

I am trying to run Google Map on a WordPress site. The code is running perfectly on this JSFIDDLE but when I take it to WordPress I am getting this error
Google Maps API warning: SensorNotRequired:
https://developers.google.com/maps/documentation/javascript/error-messages
I also tried this code
<script language="javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true&v=3"></script>
but the result is same.
Finally I tried to get a key from API and use it
<script src="https://maps.googleapis.com/maps/api/js?key=xxxxxxxxxxxxxxxxxxxxxxxxxxx&callback=initMap"
async defer></script>
and now I am getting this error
Uncaught TypeError: window.initMap is not a function
can you please let me know why this is happening and how I can fix it?
Instead of:
<script language="javascript" src="https://maps.googleapis.com/maps/api/js?sensor=true&v=3"></script>
Try:
<script language="javascript" src="https://maps.googleapis.com/maps/api/js?v=3"></script>
From the Google Maps API documentation:
The sensor parameter is no longer required for the Google Maps
JavaScript API. It won't prevent the Google Maps JavaScript API from
working correctly, but we recommend that you remove the sensor
parameter from the script element.

Grunt task producing several "undefined is not a function" errors in the final html

In an AngularJS single page application I am building, I have a grunt task that produces a separate directory which contains all the required libraries, js, css, etc. and the index.html. All the javascript code gets concatenated (not minified yet) in a single app.full.js, as well as the css code into an app.css file.
The problem I am having right now is that after the grunt tasks finishes, if I try to load the index.html in the browser then I get lots of "undefined is not a function" javascript errors in some of the components I load for the application.
The following are the scripts I load:
<script src="bower_components/jquery/jquery.js"></script>
<script src="bower_components/bootstrap/dist/js/bootstrap.js"></script>
<script src="bower_components/underscore/underscore.js"></script>
<script src="bower_components/moment/moment.js"></script>
<script src="bower_components/angular/angular.js"></script>
<script src="bower_components/angular-route/angular-route.js"></script>
<script src="bower_components/angular-animate/angular-animate.js"></script>
<script src="bower_components/angular-resource/angular-resource.js"></script>
<script src="bower_components/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script src="bower_components/angular-ui-utils/ui-utils.js"></script>
<script src="bower_components/jquery-migrate/jquery-migrate.js"></script>
<script src="bower_components/modernizr/modernizr.js"></script>
<script src="js/libs/jquery.sparkline.js"></script>
<script src="bower_components/jquery-toggles/toggles.js"></script>
<script src="js/libs/retina.js"></script>
<script src="bower_components/flot/jquery.flot.js"></script>
<script src="bower_components/flot/jquery.flot.resize.js"></script>
<script src="bower_components/morris.js/morris.js"></script>
<script src="bower_components/raphael/raphael.js"></script>
<script src="bower_components/datatables/media/js/jquery.dataTables.js"></script>
<script src="js/libs/chosen.jquery.js"></script>
<script src="bower_components/angular-chosen-localytics/chosen.js"></script>
<script src="bower_components/jquery.gritter/js/jquery.gritter.js"></script>
<script src="bower_components/ngstorage/ngStorage.js"></script>
Some of the problematic components that produce the errors mentioned above are jquery.flot.js, morris.js (haven't tested all of them though); but I presume that I might be doing something wrong in the grunt task or maybe the order above must be changed?. The following is my grunt task:
grunt.registerTask('dev',['jshint','clean:dev','dom_munger:readcss','dom_munger:readscripts','ngtemplates','concat','copy:dev','dom_mun
ger:removecss_dev','dom_munger:addcss_dev','dom_munger:removescripts_dev','dom_munger:addscript_dev','clean:after']);
If it helps I can put the details of the dom_munger tasks or any other.
Anyone knows what might be wrong?
Ok, after lots of trial and error tests, the file retina.js was the culprit. Thankfully moving it as the last script to load solved the problem.
Hope this helps anyone with a similar situation.

CSS navigation?

The navigation on the left menu in the below site uses CSS for mouseover links.PVH
When I take the code of the navigation and make it separate page. Then the mouseover links are not working. What could be the reason?
Test
Probably...
<script src="menu_1b.js" type="text/javascript">
</script>
<script src="menu_com.js" type="text/javascript">
have something to say on the matter. EDIT: A function called function CreateMenuStructureAgain() kind of gives it away.
You need to "borrow" the scripts found at
http://www.pvh.com/menu_1b.js
http://www.pvh.com/menu_com.js
and then link to them using
<script src="menu_1b.js" type="text/javascript"></script>
<script src="menu_com.js" type="text/javascript"></script>
You could probably try
<script src="http://www.pvh.com/menu_1b.js" type="text/javascript"></script>
<script src="http://www.pvh.com/menu_com.js" type="text/javascript"></script>
and it will work (provided that you have an internet connection, and they don't modify the scripts :D)
As mentioned, you needed to take the scripts too. I was going to take a look at a solution for you but then I opened the JS code you were attempting to use. You could do a lot better with a lot less code. Try looking at this menu example and the accompanying code. You should be able to do exactly what you need without the need for vast amounts of Javascript.

Resources