|
POST
|
This is a good base sample for hover tooltips - I ran into some issues with the latency on keeping features highlighted, but ended-up fixing this with some JavaScript trickeration... by tracking highlight graphics in an array and removing those currently not in focus on the next feature hover - works pretty well in removing the latent objects when moving the mouse fast across the map. Another oddity in functionality concerned the pop-up - if you mouse into the tooltip region, then out onto the basemap (not another fl feature), the graphic remains highlighted with the tooltip shown. Through some more trickeration, I ended-up with something more like this: 2014 Outlook: World Economic Growth Map - Businessweek It wasn't quite as smooth, but close enough!
... View more
05-15-2015
07:15 AM
|
0
|
0
|
416
|
|
POST
|
It looks like this works on your internal network because you are accessing just by the server name and not by a regular domain name. I would make sure DNS is set-up and your services are forward-facing from outside of your network.
... View more
05-15-2015
07:14 AM
|
0
|
0
|
1905
|
|
POST
|
Have a look at my answer in this thread: RequireJS and ArcGIS API for JS I believe this may help you out a bit.
... View more
05-14-2015
05:59 AM
|
0
|
0
|
568
|
|
POST
|
Evelyn, I tested and got this working as a demo app! I don't think it answers your requirements entirely, but it does allow you to modularize a bit more. I can't post a jsFiddle with external file resources, but this should work for you: <!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<style>
html, body, #mapDiv {
padding: 0;
margin: 0;
height: 100%;
}
</style>
<script type="text/javascript">
var dojoConfig = {
packages: [{
name: 'jsModules',
location: location.pathname.replace(/\/[^/]+$/, '') + '/jsModules'
}]
};
</script>
<link rel="stylesheet" href="http://js.arcgis.com/3.13/esri/css/esri.css">
<script src="http://js.arcgis.com/3.13/"></script>
<script type="text/javascript">
require([
"jsModules/myMap",
"dojo/ready"
], function (
myMap,
ready
) {
ready(function () {
var myMapInit = new myMap();
}
);
});
</script>
<title>Test Map</title>
</head>
<body class="claro">
<div id="printButton"></div>
<div id="mapDiv"></div>
</body>
</html> Here's the module: define([
"dojo/_base/declare",
"esri/map",
"dojo/parser",
"dojo/dom",
"dojo/domReady!"
], function (
declare,
Map,
parser,
dom
) {
return declare(null, {
constructor: function (options) {
this._makeMap();
},
_makeMap: function () {
parser.parse();
map = new Map("mapDiv", {
zoom: 3,
basemap: "topo"
});
}
});
}); The way I have this set-up is http://localhost/myTestMap/map.html with the module located in myTestMap/jsModules/myMap.js
... View more
05-13-2015
12:06 PM
|
0
|
2
|
4847
|
|
POST
|
I goofed on some syntax stuff - should be updated (still untested, though).
... View more
05-13-2015
11:16 AM
|
0
|
0
|
4847
|
|
POST
|
Will something like this work for you (please note, this is untested)? In your main html page: <script type="text/javascript">var dojoConfig = {
packages: [{
"name": "jsModules",
"location": location.pathname.replace(/\/[^/]+$/, "") + "/jsModules" //this line may be different for you
}]
};
</script>
<script type="text/javascript">
require([
"jsModules/myMap",
"dojo/ready"
], function (
myMap,
ready
) {
ready(function () {
var myMapInit = new myMap();
}
);
});
</script> Your "myMap" module could contain the basic map example from Esri: define([
"dojo/_base/declare",
"esri/map",
"dojo/parser",
"dojo/dom",
"dojo/domReady!"
], function (
declare,
Map,
parser,
dom
) {
return declare(null, {
constructor: function (options) {
this._makeMap();
},
_makeMap: function () {
parser.parse();
map = new Map("mapDiv", {
zoom: 3,
basemap: "topo"
});
}
});
});
... View more
05-13-2015
10:54 AM
|
0
|
2
|
4847
|
|
POST
|
According to the API: Note: The KMLLayer uses a utility service from ArcGIS.com, therefore your kml/kmz must be publicly accessible on the internet. If your kml/kmz files are behind the firewall you will need to set the esriConfig.defaults.kmlService to your own utility service. (Requires Portal for ArcGIS). KMLLayer | API Reference | ArcGIS API for JavaScript So it seems possible - I'm not familiar with Portal, though. UPDATE: Lol, it's been a long day... I just realized the service you posted is on ArcGIS.com, so... if we can already get a KML response from local data sent to the service, then I don't see why we wouldn't be able to do this - maybe someone from Esri can chime in.
... View more
05-12-2015
12:04 PM
|
1
|
0
|
4026
|
|
POST
|
I pulled a KML from the Esri demo, then used an encoder (URL Decoder/Encoder ) to convert the XML into an encoded string. I had to adjust the beginning of the file to avoid the "content not allowed in prolog" error with the following header: <?xml version="1.0" encoding="UTF-16" standalone="no"?> This jQuery script should work! You just need to get the encoded string/file. Hope this helps! $.post( "https://utility.arcgis.com/sharing/kml", { refresh: "false",url: "", kmlString: "%3C%3Fxml%20version%3D%221.0%22%20encoding%3D%22UTF-16%22%20standalone%3D%22no%22%3F%3E%0A%3Ckml%20xmlns%3D%22http%3A%2F%2Fwww.opengis.net%2Fkml%2F2.2%22%20xmlns%3Akml%3D%22http%3A%2F%2Fwww.opengis.net%2Fkml%2F2.2%22%3E%0A%3CDocument%3E%0A%09%3Cname%3EWY.kml%3C%2Fname%3E%0A%09%3CStyleMap%20id%3D%22msn_ylw-pushpin%22%3E%0A%09%09%3CPair%3E%0A%09%09%09%3Ckey%3Enormal%3C%2Fkey%3E%0A%09%09%09%3CstyleUrl%3E%23sn_ylw-pushpin%3C%2FstyleUrl%3E%0A%09%09%3C%2FPair%3E%0A%09%09%3CPair%3E%0A%09%09%09%3Ckey%3Ehighlight%3C%2Fkey%3E%0A%09%09%09%3CstyleUrl%3E%23sh_ylw-pushpin%3C%2FstyleUrl%3E%0A%09%09%3C%2FPair%3E%0A%09%3C%2FStyleMap%3E%0A%09%3CStyle%20id%3D%22sn_ylw-pushpin%22%3E%0A%09%09%3CLineStyle%3E%0A%09%09%09%3Ccolor%3Eff1378fa%3C%2Fcolor%3E%0A%09%09%3C%2FLineStyle%3E%0A%09%09%3CPolyStyle%3E%0A%09%09%09%3Ccolor%3E590e87ff%3C%2Fcolor%3E%0A%09%09%3C%2FPolyStyle%3E%0A%09%3C%2FStyle%3E%0A%09%3CStyle%20id%3D%22sh_ylw-pushpin%22%3E%0A%09%09%3CLineStyle%3E%0A%09%09%09%3Ccolor%3Eff1378fa%3C%2Fcolor%3E%0A%09%09%3C%2FLineStyle%3E%0A%09%09%3CPolyStyle%3E%0A%09%09%09%3Ccolor%3E590e87ff%3C%2Fcolor%3E%0A%09%09%3C%2FPolyStyle%3E%0A%09%3C%2FStyle%3E%0A%09%3CPlacemark%3E%0A%09%09%3Cname%3EWyoming(WY)%3C%2Fname%3E%0A%09%09%3CstyleUrl%3E%23msn_ylw-pushpin%3C%2FstyleUrl%3E%0A%09%09%3CPolygon%3E%0A%09%09%09%3CouterBoundaryIs%3E%0A%09%09%09%09%3CLinearRing%3E%0A%09%09%09%09%09%3Ccoordinates%3E%0A%09%09%09%09%09%09-111.0104571412223%2C41.0089819627255%2C0%20-104.030274231128%2C41.02828129140075%2C0%20-104.0319709660267%2C44.99724476991338%2C0%20-111.0393843561171%2C45.01103168687777%2C0%20-111.0104571412223%2C41.0089819627255%2C0%20%0A%09%09%09%09%09%3C%2Fcoordinates%3E%0A%09%09%09%09%3C%2FLinearRing%3E%0A%09%09%09%3C%2FouterBoundaryIs%3E%0A%09%09%3C%2FPolygon%3E%0A%09%3C%2FPlacemark%3E%0A%3C%2FDocument%3E%0A%3C%2Fkml%3E" })
.done(function( data ) {
alert( "Data Loaded: " + data );
});
... View more
05-12-2015
11:47 AM
|
1
|
2
|
4023
|
|
POST
|
I tried sending it via the query string, but it is throwing an error on the return: http://utility.arcgis.com/sharing/kml?kmlString=%3Ckml%20xmlns%3D%22http%3A%2F%2Fwww.opengis.net%2Fkml%2F2.2%22%20xmlns%… You may need to post to the service.
... View more
05-12-2015
11:29 AM
|
1
|
0
|
4026
|
|
POST
|
Looking at the Esri example: KML | ArcGIS API for JavaScript It looks like the utility is hit when the KML layer is instantiated: http://utility.arcgis.com/sharing/kml?url=https%3A%2F%2Fdl.dropboxusercontent.com%2Fu%2F2654618%2Fkml%2FWyoming.kml&mode… Instead of sending the "url" querystring param try sending it manually with an encoded KML string as kmlString="myKmlString..."
... View more
05-12-2015
11:19 AM
|
1
|
4
|
4026
|
|
POST
|
I'm unsure, but could you check by pulling the first layer? http://maps.decaturil.gov/arcgis/rest/services/test/StreetSignTest/FeatureServer/0
... View more
05-11-2015
11:55 AM
|
2
|
8
|
1690
|
|
POST
|
Chris mentioned about checking it before his code runs - I wasn't too sure if he meant before his mapping app loaded, or before some bit of code executed in the map app. If it's the latter, it looks like Todd has a better resolution in catching the error.
... View more
05-11-2015
09:23 AM
|
0
|
1
|
2454
|
|
POST
|
Just to clarify, when I'm referring to the map service throwing a 500 when it doesn't exist, this is assuming the server does exist, e.g. myMapServer/arcgis/rest/services/base_services/1234_does_not_exist/MapServer Throws a 500 because the server page will still exist (just indicating a status of 500 and that the map service does not exist). I verified in Fiddler the 500 code is still given. You could also add a case for a 404, if needed, so if the server was completely not found: $.ajax(serviceURL, {
type: "POST",
statusCode: {
404: function (response) {
alert('404, not found');
},
500: function (response) {
alert('500 error');
}
}, success: function () {
alert('success');
},
});
... View more
05-11-2015
08:47 AM
|
2
|
14
|
2454
|
|
POST
|
Highcharts is a pretty nice charting library. It's not too costly, either.
... View more
05-11-2015
08:36 AM
|
0
|
2
|
1958
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 06-16-2020 01:25 PM | |
| 1 | 03-20-2019 09:07 AM | |
| 2 | 07-31-2015 07:31 AM | |
| 1 | 09-14-2015 12:14 PM | |
| 1 | 05-12-2015 12:04 PM |
| Online Status |
Offline
|
| Date Last Visited |
07-27-2023
02:30 AM
|