Using leaflet with arcgis map - javascript

I've been using arc maps but now trying to just play around with this leaflet script files. I'm getting an undefined basemap error and not exactly sure where its coming from. Following all the examples to a t and still the error. Any help is greatly appreciated.
This is the example i've been following https://github.com/Esri/esri-leaflet
Here is the code:
<script src="http://cdn.leafletjs.com/leaflet-0.6.4/leaflet.js"></script>
<script src="http://cdn.leafletjs.com/leaflet-0.7/leaflet.js"></script>
<script src="lib/esri-leaflet/esri-leaflet.js"></script>
<script type="text/javascript">
//basemap
var map = L.map('map').setView([37.75, -122.45], 12);
L.esri.basemapLayer("Gray").addTo(map);
L.esri.featureLayer("http://gis.chmuraecon.com/arcgis/rest/services/jobseq/Demographics/MapServer/1", {
}).addTo(map);
</script>

Related

Bing Maps Error - Microsoft is not defined? [duplicate]

I am using bing map in my application for searching.
Bing map V8 control.
I have used this CDN
<script type='text/javascript' src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=api_key' async defer></script>
after that when I am trying to use Microsoft.Maps. It is saying:
Uncaught ReferenceError: Microsoft is not defined
new Microsoft.Maps.Color(100,100,0,100);
Any one have idea about this?
Don't use async while loading Bing API,
<script src='http://www.bing.com/api/maps/mapcontrol?callback=GetMap&key=api_key'
type='text/javascript' ></script>
And if you are using jQuery then add $.ready() to use maps like
<script>
$(function(){
var color = new Microsoft.Maps.Color(100,100,0,100);
....
});
</script>
I encountered a similar error while using bing maps js sdk. All you have to do is to add 'windows.' before you write: Microsoft.Maps.Color(100,100,0,100);
So now the new code is :
new window.Microsoft.Maps.Color(100,100,0,100);

How to add google charts using Rally SDK2.1

I am hitting my head to wall with this.
APP SDK 2.0: Charts in the short term?
I followed above post to add google charts to rally report but ran into problem. I was expecting the answer by mattparrish in that post to work. but it throws following error:
sdk-debug.js:147611 Error: success callback for Deferred transformed result of Deferred transformed result of Deferred threw: TypeError: Cannot read property 'dom' of undefined
at constructor._drawChart (App.js?_dc=0.8649522877525893:36)
at constructor.launch (App.js?_dc=0.8649522877525893:30)
at constructor._applyDefaultSettingsAndLaunch (sdk-debug.js:155148)
at constructor.loadSettingsAndLaunch (sdk-debug.js:155054)
at constructor.initComponent (sdk-debug.js:155032)
at constructor (sdk-debug.js:30211)
at constructor.callParent (sdk-debug.js:4469)
at constructor [as _componentConstructor] (sdk-debug.js:34291)
at constructor.callParent (sdk-debug.js:4469)
at constructor (sdk-debug.js:144823)
This is how i am adding google jsapi to rally report:
<!DOCTYPE html>
<html>
<head>
<title>ExtPlusGoogleCharts</title>
<script type="text/javascript" src="https://rally1.rallydev.com/apps/2.1/sdk-debug.js"></script>
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1.0", {packages:["corechart"]});
google.setOnLoadCallback( Rally.loadScripts(
[
"App.js",
],
function() {
Rally.launchApp('CustomApp', {
name:"ExtPlusGoogleCharts"
});
}, true));
</script>
<link rel="stylesheet" type="text/css" href="app.css"/>
</head>
<body>
</body>
</html>
Can we add google charts in rally SDK2.1? If yes, how? Thanks!
Just out of curiosity, is there a special reason you'd like to use google charts? That question you referenced is pretty old and pre-dates the current charting platform in App SDK 2.1, which uses Highcharts.
There's a solid example of how to do this here: https://help.rallydev.com/apps/2.1/doc/#!/example/bare-metal-chart
I'm not all that familiar with google charts, so if you'd still like to use those someone else will probably have to post an answer on that. But hopefully you can use our built-in chart component...

Using GMaps.js for integrating Google Maps API - can't see where to add my API Key

I am using the GMaps.js library and the code I am using is working 100% fine (running locally on localhost) - the 'webapp' I have created also uses the Google Maps Geocoding API.
I cannot see where I add my API keys anywhere within my code - although I am kinda confused as it currently works? Surely it should only work with a valid API key.
https://hpneo.github.io/gmaps/
<!DOCTYPE html>
<html>
<head>
<link href='example.css' rel='stylesheet' type='text/css' />
<link rel="stylesheet" type="text/css" href="style/style.css">
<script type="text/javascript" src="gmaps.js"></script>
<script type="text/javascript">
map = new GMaps({
div: '#map',
lat: 52.4801,
lng: -1.8835,
zoom: 7
});
</script>
</head>
<body>
<div id="map"></div>
</body>
</html>
<script async defer src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY_HERE" type="text/javascript"></script>
Replace the placeholder text in the above snippet with your gmaps api key and insert in your header above the gmaps.js script.
By viewing the example codes, no API key is used. So I would guess you don't need one.
Although you could supply google with a API key when embedding the maps api
Ok - i have found the answer here:
When is a Google Maps API key required?
In a nutshell version 3 doesn't require an API (v2 did) but it is recommended from what other developer are saying in regards to setting them up.

googlemaps api v2 to v3

I searched and tried but failed
I am using an older version of ez realty which seems to call google maps with this code:
<script src="http://maps.google.com/maps?file=api&v=2.x&key=<?php echo $config->er_mapapi;?>" type="text/javascript"></script>
which now produces a grey rectangle but no map anymore
Tried to replace that with v3 googlemap api :
<script type="text/javascript" src="//maps.googleapis.com/maps/api/js?key=<?php echo $config->er_mapapi;?>&sensor=false"></script>
but that just produces a white area where the map used to be, so obviously not calling the map right.
It is not mandatory to provide a key if you are within free usage limits.
Try to include it like this:
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>

How to know the origins of some data loaded in a google map with java?

is possible to know the location of the file who have the data loaded on this map? http://www.comune.monza.it/portale/mappe/mappa_giardini.html
Thanks for any help!
The Lat and Lng of the markers on this map is located within the view source. Take a look at the Gmarker created from approximately line 741-1126. Seems like it's all there within the page.
Furthermore, seems like they use jquery, markermanager, pano_layer, and pano map control.
<script src="http://gmaps-utility-library.googlecode.com/svn/trunk/markermanager/release/src/markermanager.js" type="text/javascript"></script>
<script src="/system/modules/it.tecnoteca.googlemap/resources/script/pano_layer.js" type="text/javascript"></script>
<script src="/system/modules/it.tecnoteca.googlemap/resources/script/pano_maptypecontrol.js" type="text/javascript"></script>
<script src="/system/modules/it.mi.monza.comune.monza_partecipa/resources/script/jquery.js" type="text/javascript"></script>
All the datapoints for that are hard coded in the javascript in the html for the mappa_giardini.html file. Search the file for
point = new GLatLng(45.55889209225004,9.266018271446228);
Look at a couple of the lines and you'll see how its set up.

Categories

Resources