POST
|
Thanks Robert but this doesn't help either. besides In that case I need to create another map object that looks like it is unnecessary! am I correct?
... View more
11-08-2016
03:41 PM
|
0
|
2
|
813
|
POST
|
I am trying to utilize and use Dojo on an ASP.Net MVC platform. in Index() view I have @{
ViewBag.Title = "Home Page";
}
<link rel="stylesheet" href="http://js.arcgis.com/3.18/dijit/themes/nihilo/nihilo.css">
<link rel='stylesheet' href='http://js.arcgis.com/3.18/esri/css/esri.css' />
<script src="http://js.arcgis.com/3.18"></script>
<script src="~/Map/config.js"></script>
<div class="container">
<a role="button" id="lib" class="btn btn-default">Add Libraries</a>
<a role="button" id="sch" class="btn btn-default">Add Schools</a>
<div class="col-md-12" id="map-div"></div>
</div> in the `config.js` I have (function () {
'use strict';
var pathRX = new RegExp(/\/[^\/]+$/)
, locationPath = location.pathname.replace(pathRX, '');
require({
async: true,
aliases: [
['text', 'dojo/text']
],
packages: [{
name: 'MapCoctent',
location: locationPath + '../Map/MapCoctent'
}, {
name: 'MapServices',
location: locationPath + '../Map/MapServices'
}, {
name: 'Map',
location: locationPath + '../Map',
main: 'map'
}]
}, ['Map']);
})();
and in the `map.js` I have require([
'MapCoctent/appcontroller',
'MapServices/mapservices',
'dojo/domReady!'
], function (AppCtrl, mapServices) {
'use strict';
var appCtrl = new AppCtrl({
elem: 'map-div',
mapOptions: {
basemap: 'streets',
center: [-123.141608, 49.245291],
zoom: 12,
autoResize: false
}
});
appCtrl.load();
}); and finally in `mapservices.js` I have define(["esri/geometry/Geometry",
"esri/geometry/Point",
"esri/graphic",
"esri/symbols/SimpleMarkerSymbol",
"esri/symbols/SimpleFillSymbol",
"esri/Color",
"dojo/on",
"dojo/dom"
], function (Geometry, Point, Graphic, SimpleMarkerSymbol, SimpleFillSymbol, Color, on, dom) {
on(dom.byId("sch"), "click", function () {
var point = new Point(-123.141608, 49.245291);
var markerSymbol = new SimpleMarkerSymbol();
markerSymbol.setStyle(SimpleMarkerSymbol.STYLE_SQUARE);
markerSymbol.setSize(12);
markerSymbol.setColor(new Color([255, 0, 0]));
var pointGraphic = new Graphic(point, markerSymbol);
map.graphics.add(pointGraphic);
});
}); in `appcontroller.js` I have define([
'dojo/_base/declare',
'esri/map'
], function ( declare, Map) {
return declare(null, {
map: null,
options: {},
constructor: function (options) {
this.options = options;
},
load: function () {
this.map = new Map(this.options.elem, this.options.mapOptions);
}
});
}); but when I click on Add Schools button I am getting this error Error TypeError: map.graphics is undefined can you please let me know what I am doing wrong and why the map still is undefined while is already instantiated on the page?
... View more
11-08-2016
02:20 PM
|
0
|
6
|
2334
|
POST
|
Thanks for comment Jake, but as you can see in the URL I am not getting any FeatureService but MapServer instead!
... View more
10-28-2016
02:43 PM
|
0
|
1
|
612
|
POST
|
Following ESRI documentation at Here I am trying to publish a Map as Feature Server by enabling the Feature Access on Capability bur when I publish the Map the result looks like As you can see the URL ends with /MapServer while I need to get a /FeatureServer like Can you please let me know what I am doing wrong?
... View more
10-28-2016
11:10 AM
|
0
|
4
|
1240
|
POST
|
Can you please take a look at this demo and let me know why I am getting this error Uncaught ReferenceError: ArcGISDynamicMapServiceLayer is not defined As you can see I have registered the "esri/layers/ArcGISDynamicMapServiceLayer", but still getting the error var map;
var layerOpacity = 0.25;
require(["esri/map",
"esri/layers/ArcGISDynamicMapServiceLayer",
"dojo/parser",
"dojo/dom",
"dojo/on",
"dojo/ready",
"dojo/domReady!"], function (
Map,
ArcGISDynamicMapServiceLayer,
parser,
dom,
on,
ready) {
map = new Map("mapDiv", {
center: [-126.687482, 54.793577],
zoom: 5,
basemap: "topo"
});
});
var appLayer = new ArcGISDynamicMapServiceLayer("http://renewablestoolbox.biol.sfu.ca/rorapp/rest/services/RORApp/MapServer/22");
map.addLayer(appLayer);
... View more
11-06-2015
05:55 AM
|
0
|
2
|
2925
|
POST
|
in That case how can I reference to fishing_effort.tif (ID: 53)? I mean the RORApp (MapServer) is URL of all Layers but I need to only display fishing_effort.tif (ID: 53)!
... View more
10-28-2015
03:41 PM
|
0
|
2
|
765
|
POST
|
Thanks Rickey, I actually used same example with different Mapserver of the post which you linked but I am not getting what exactly means when they say : For Dynamic Map Service Layers, you do not want to specify the index of the layer in the URL. ?!
... View more
10-28-2015
03:27 PM
|
0
|
4
|
765
|
POST
|
Can you please take a look at This Demo and let me know why I am not able to add the Raster Layer Layer: fishing_effort.tif (ID: 53) into the Map? var map;
require([
"esri/map",
"esri/layers/ArcGISDynamicMapServiceLayer",
"dojo/ready",
"dojo/parser",
"dijit/layout/BorderContainer",
"dijit/layout/ContentPane"],
function (
Map, ArcGISDynamicMapServiceLayer,
ready, parser,
BorderContainer, ContentPane) {
ready(function () {
parser.parse();
map = new Map("cpCenter", {
basemap: "topo",
center: [-9.113077, 0.759423],
zoom: 2
});
var layer = new ArcGISDynamicMapServiceLayer("http://renewablestoolbox.biol.sfu.ca/rorapp/rest/services/RORApp/MapServer/53")
map.addLayers([layer]);
});
}); as you can see from the console I am getting 400 (Bad Request) error message but the layer is for sure at This Url Thanks
... View more
10-28-2015
02:47 PM
|
0
|
6
|
3219
|
POST
|
Thanks Robert but I tried to do what you recommend but I am not sure why I am getting this error I already register the "esri.layers.FeatureLayer", and function(Map, FeatureLayer, but still getting this!
... View more
10-23-2015
07:16 PM
|
0
|
1
|
599
|
POST
|
Can you please take a look at this code and let me know how I can add and remove some layers based on their index number in a Map Service? I tried this before but it is not working! Layer 52 : <input type="checkbox" value=52 name="overlayLayers"><br />
Layer 53 : <input type="checkbox" value=53 name="overlayLayers"><br /> var service ="http://renewablestoolbox.biol.sfu.ca/rorapp/rest/services//RORApp/MapServer";
$('input:checkbox[name=overlayLayers]').on('change', function(){
if($(this).is(':checked')){
var index = $(this).val();
map.addLayer(service+index);
}
else{
var index = $(this).val();
map.removeLayer(service+index);
}
});
... View more
10-23-2015
02:29 PM
|
0
|
3
|
2807
|
POST
|
I am adding a markers layer called `layer1` like this to map function drawPoints(mapInfo) {
layer1 = new esri.layers.GraphicsLayer();
for (var i = 0; i < mapInfo.length; i++) {
var projects = mapInfo;
var project = new esri.geometry.Point(projects.Longitude, projects.Latitude);
project = esri.geometry.geographicToWebMercator(project);
var symbol = new esri.symbol.PictureMarkerSymbol("img/map/marker.png", 18, 18);
projectInfoTemplate = new InfoTemplate();
projectInfoTemplate.setTitle("Project Details");
projectInfoTemplate.setContent('<div class="row"></div> ');
var projectsG = new esri.Graphic(project, symbol).setInfoTemplate(projectInfoTemplate);
layer1.add(projectsG);
}
map.addLayer(layer1);
} now in next request I need to clear map so I used the map.removeLayer(layer1); but this is causing error because the `layer1` still not created at first request. Now I need to check `IF` the map has a layer called `layer1` then removeit. Here is a pseudo code of what I need to do: if(map.has/contains/include(layer1){
map.removeLayer(layer1);
} can you please let me know how to do that?
... View more
09-15-2015
06:47 PM
|
0
|
3
|
3055
|
POST
|
I followed This API Tutorial to create Cluster Points on the map. Now I would like to have a function to hide them. I already tried like? clusterLayer.hide(); but it didn't work! I also tried to bind the clusterLayer to a GraphicsLayer like below var clayer = new esri.layers.GraphicsLayer();
clayer.add(clusterLayer);
clayer.hide(); but still not working After hours of working I find a sample on google at this Demo doing the job of switching between Points and Cluster but it is supper complicated to me! Can you please let me know how I can hide and show the cluster layer on demand?
... View more
09-05-2015
03:54 AM
|
0
|
2
|
3020
|
POST
|
Can you please let me know how I can apply Style or append HTML markup into infoTemplate like this var symbol = new PictureMarkerSymbol("img/direqyb6T.png", 32, 32);
layer2 = new GraphicsLayer();
var infoTemplate = new InfoTemplate("Project Details", "${*}");
arrayUtils.forEach(points, function (project) {
att = {
"Project Id": project.ProjectID,
"Longitude": project.Longitude,
"Latitude": project.Latitude
};
mp = new Point(project.Longitude, project.Latitude);
var projGra = new Graphic(mp, symbol, att);
layer2.add(projGra);
}); layer2.setInfoTemplate(infoTemplate);
map.addLayer(layer2); this code is generating a popup like below but I need to show the information in a HTML table or apply some css rules? Thanks
... View more
09-04-2015
10:23 PM
|
0
|
1
|
2618
|
POST
|
Thanks Robert but can you please let me know what the AMD is?
... View more
09-04-2015
05:19 PM
|
0
|
1
|
451
|
POST
|
I have a code like below which is suppose to add over 600 points into a GraphicLayer `projectsG` and eventually add the `projectsG` to `layer1` and `map` but I am not sure what I am doing wrong in projectsG = new esri.Graphic(project, symbol).setInfoTemplate(projectInfoTemplate);
}
console.log(thepoints);
layer1 = new esri.layers.GraphicsLayer();
for (i = 0; i < points.length; ++i) {
layer1.add(projectsG);
} part which only adds the Last project into the map! Can you please take a look at following code and let me know what I am doing wrong in looping? var layer1,
var thepoints=[];
var projectInfoTemplate;
var projectsG;
var points = [
{
"ProjectID":"15260",
"Longitude":"-118.641508",
"Latitude":"51.949915",
},
{
"ProjectID":"17043",
"Longitude":"-125.444557",
"Latitude":"51.097552",
},
....
{
"ProjectID":"13009",
"Longitude":"-130.257086",
"Latitude":"56.882834",
},
{
"ProjectID":"17088",
"Longitude":"-124.160699",
"Latitude":"50.897618",
}
];
function drawSeries1() {
for (var i = 0; i < points.length; i++) {
var projects = points;
var project = new esri.geometry.Point(projects.Longitude, projects.Latitude);
project = esri.geometry.geographicToWebMercator(project);
var symbol = new esri.symbol.PictureMarkerSymbol("e-Chartreuse.png", 32, 32);
projectInfoTemplate = new InfoTemplate();
projectInfoTemplate.setTitle("Project Details");
projectInfoTemplate.setContent('<div>Some Att Here</div> ');
projectsG = new esri.Graphic(project, symbol).setInfoTemplate(projectInfoTemplate);
thepoints.push(projectsG);
}
console.log(thepoints);
layer1 = new esri.layers.GraphicsLayer();
for (i = 0; i < points.length; ++i) {
layer1.add(projectsG);
}
map.addLayer(layer1);
}
... View more
09-04-2015
03:52 PM
|
0
|
3
|
2721
|
Title | Kudos | Posted |
---|---|---|
1 | 03-07-2011 02:23 PM | |
1 | 09-02-2015 12:50 AM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:23 AM
|