|
POST
|
Here is the code snippet you can use. Create the separate variables for each feature layer. Hope it helps. <!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"> <title></title> <link rel="stylesheet" href="https://js.arcgis.com/3.18/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css"> <style> html,body{height:100%;width:100%;margin:0;overflow:hidden;} #map{ padding:0; } #header{ font-size: 1.1em; font-family: sans-serif; padding-left: 1em; padding-top:4px; color:#660000; } .templatePicker { border: none; } .dj_ie .infowindow .window .top .right .user .content { position: relative; } .dj_ie .simpleInfoWindow .content { position: relative; } </style> <script src="https://js.arcgis.com/3.18/"></script> <script> var map; require([ "esri/map", "esri/tasks/GeometryService", "esri/layers/ArcGISDynamicMapServiceLayer", "esri/layers/FeatureLayer", "esri/Color", "esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol", "esri/dijit/editing/Editor", "esri/dijit/editing/TemplatePicker", "esri/config", "dojo/i18n!esri/nls/jsapi", "dojo/_base/array", "dojo/parser", "dojo/keys", "dijit/layout/BorderContainer", "dijit/layout/ContentPane", "dojo/domReady!" ], function( Map, GeometryService, ArcGISDynamicMapServiceLayer, FeatureLayer, Color, SimpleMarkerSymbol, SimpleLineSymbol, Editor, TemplatePicker, esriConfig, jsapiBundle, arrayUtils, parser, keys ) { parser.parse(); // snapping is enabled for this sample - change the tooltip to reflect this jsapiBundle.toolbars.draw.start = jsapiBundle.toolbars.draw.start + "<br>Press <b>ALT</b> to enable snapping"; // refer to "Using the Proxy Page" for more information: https://developers.arcgis.com/javascript/3/jshelp/ags_proxy.html esriConfig.defaults.io.proxyUrl = "/proxy/"; //This service is for development and testing purposes only. We recommend that you create your own geometry service for use within your applications. esriConfig.defaults.geometryService = new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer"); map = new Map("map", { basemap: "topo", center: [-88.55, 43.12], zoom: 9, slider: false }); map.on("layers-add-result", initEditor); //add boundaries and place names var labels = new ArcGISDynamicMapServiceLayer("Enter the URL of your Mapserver"); map.addLayer(labels); // If your features are points. var responsePoints = new FeatureLayer("YourURL/FeatureServer/1", { mode: FeatureLayer.MODE_ONDEMAND, outFields: ['*'] }); //If your features are a polygon var responsePolys = new FeatureLayer("YourURL/FeatureServer/5", { mode: FeatureLayer.MODE_ONDEMAND, outFields: ['*'] }); map.addLayers([responsePolys, responsePoints]); function initEditor(evt) { var templateLayers = arrayUtils.map(evt.layers, function(result){ return result.layer; }); var templatePicker = new TemplatePicker({ featureLayers: templateLayers, grouping: true, rows: "auto", columns: 3 }, "templateDiv"); templatePicker.startup(); var layers = arrayUtils.map(evt.layers, function(result) { return { featureLayer: result.layer }; }); var settings = { map: map, templatePicker: templatePicker, layerInfos: layers, toolbarVisible: true, createOptions: { polylineDrawTools:[ Editor.CREATE_TOOL_FREEHAND_POLYLINE ], polygonDrawTools: [ Editor.CREATE_TOOL_FREEHAND_POLYGON, Editor.CREATE_TOOL_CIRCLE, Editor.CREATE_TOOL_TRIANGLE, Editor.CREATE_TOOL_RECTANGLE ] }, toolbarOptions: { reshapeVisible: true } }; var params = { settings: settings }; var myEditor = new Editor(params, 'editorDiv'); //define snapping options var symbol = new SimpleMarkerSymbol( SimpleMarkerSymbol.STYLE_CROSS, 15, new SimpleLineSymbol( SimpleLineSymbol.STYLE_SOLID, new Color([255, 0, 0, 0.5]), 5 ), null ); map.enableSnapping({ snapPointSymbol: symbol, tolerance: 20, snapKey: keys.ALT }); myEditor.startup(); } }); </script> </head> <body class="claro"> <div id="main" data-dojo-type="dijit/layout/BorderContainer" data-dojo-props="design:'headline'" style="width:100%;height:100%;"> <div data-dojo-type="dijit/layout/ContentPane" id="header" data-dojo-props="region:'top'"> Edit USAR Location and Study Area </div> <div data-dojo-type="dijit/layout/ContentPane" data-dojo-props="region:'left'" style="width: 300px;overflow:hidden;"> <div id="templateDiv"></div> <div id="editorDiv"></div> </div> <div data-dojo-type="dijit/layout/ContentPane" id="map" data-dojo-props="region:'center'"></div> </div> </body> </html>
... View more
10-23-2016
01:04 PM
|
0
|
0
|
3229
|
|
POST
|
Thank you so much Robert. You fixed the issue. It's working fine now.
... View more
10-19-2016
09:03 AM
|
0
|
1
|
861
|
|
POST
|
I am trying to add Basemap Gallery and Navigation Toolbar on my map using ArcGIS API for JavaScript 3.18. Could somebody please tell me what is wrong with the following codes? <!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">
<title></title>
<link rel="stylesheet" href="https://js.arcgis.com/3.18/esri/css/esri.css">
<link rel="stylesheet" href="https://js.arcgis.com/3.18/dijit/themes/claro/claro.css">
<style>
html, body{
height: 100%;
width: 100%;
margin-top: 13px;
overflow: hidden;
padding-bottom: 0;
}
#map {
padding-top: 6px;
width: 90%;
height: 100%;
margin-bottom: 0;
}
#navToolbar {
border: 2px solid lightgray;
width: 14%;
border-radius: 10px;
}
.zoominIcon {
background-image: url(Images/zoom-in.png);
width: 16px;
height: 16px;
}
.zoomoutIcon {
background-image: url(Images/zoom-out.png);
width: 16px;
height: 16px;
}
.zoomfullextIcon {
background-image: url(Images/zoom-full.png);
width: 16px;
height: 16px;
}
.zoomprevIcon {
background-image: url(Images/zoom-previous.png);
width: 16px;
height: 16px;
}
.zoomnextIcon {
background-image: url(Images/zoom-next.png);
width: 16px;
height: 16px;
}
.panIcon {
background-image: url(Images/pan.png);
width: 16px;
height: 16px;
}
.deactivateIcon {
background-image: url(Images/deactivate.png);
width: 16px;
height: 16px;
}
</style>
<script src="https://js.arcgis.com/3.18/"></script>
<script>
var map, navToolbar;
require([
"esri/map",
"esri/toolbars/navigation",
"esri/dijit/BasemapGallery",
"dojo/on",
"dojo/parser",
"dijit/registry",
"dijit/Toolbar",
"dijit/form/Button",
"dojo/domReady!"
],
function (Map, Navigation, BasemapGallery, on, parser, registry) {
parser.parse();
//var navToolbar;
map = new Map("map", {
basemap: "topo",
center: [-88.55, 43.12],
zoom: 9
});
var basemapGallery = new BasemapGallery({
showArcGISBasemaps: true,
map: map
}, "basemapGallery");
basemapGallery.startup();
basemapGallery.on("error", function (msg) {
console.log("basemap gallery error: ", msg);
});
navToolbar = new Navigation(map);
on(navToolbar, "onExtentHistoryChange", extentHistoryChangeHandler);
registry.byId("zoomin").on("click", function () {
navToolbar.activate(Navigation.ZOOM_IN);
});
registry.byId("zoomout").on("click", function () {
navToolbar.activate(Navigation.ZOOM_OUT);
});
registry.byId("zoomfullext").on("click", function () {
navToolbar.zoomToFullExtent();
});
registry.byId("zoomprev").on("click", function () {
navToolbar.zoomToPrevExtent();
});
registry.byId("zoomnext").on("click", function () {
navToolbar.zoomToNextExtent();
});
registry.byId("pan").on("click", function () {
navToolbar.activate(Navigation.PAN);
});
registry.byId("deactivate").on("click", function () {
navToolbar.deactivate();
});
function extentHistoryChangeHandler () {
registry.byId("zoomprev").disabled = navToolbar.isFirstExtent();
registry.byId("zoomnext").disabled = navToolbar.isLastExtent();
}
});
</script>
</head>
<body class="claro" >
<div id="navToolbar" data-dojo-type="dijit/Toolbar" style="position:absolute; right:200px; top:10px; z-Index:555;">
<div data-dojo-type="dijit/form/Button" id="pan" data-dojo-props="iconClass:'panIcon'"></div>
<div data-dojo-type="dijit/form/Button" id="zoomin" data-dojo-props="iconClass:'zoominIcon'"></div>
<div data-dojo-type="dijit/form/Button" id="zoomout" data-dojo-props="iconClass:'zoomoutIcon'"></div>
<div data-dojo-type="dijit/form/Button" id="zoomfullext" data-dojo-props="iconClass:'zoomfullextIcon'"></div>
<div data-dojo-type="dijit/form/Button" id="zoomprev" data-dojo-props="iconClass:'zoomprevIcon'"></div>
<div data-dojo-type="dijit/form/Button" id="zoomnext" data-dojo-props="iconClass:'zoomnextIcon'"></div>
<div data-dojo-type="dijit/form/Button" id="deactivate" data-dojo-props="iconClass:'deactivateIcon'"></div>
</div>
<div id="map" style="width: 100%; height: 902px">
</div>
<!-- The navigation toolbar only shos up if the following codes are removed. -->
<div style="position:absolute; right:500px; top:10px; z-Index:999;">
<div data-dojo-type="dijit/TitlePane"
data-dojo-props="title:'Switch Basemap', closable:false, open:false">
<div data-dojo-type="dijit/layout/ContentPane" style="width:380px; height:280px; overflow:auto;">
<div id="basemapGallery"></div>
</div>
</div>
</div>
</body>
</html>
... View more
10-19-2016
08:42 AM
|
0
|
3
|
1103
|
|
POST
|
ArcGIS API for JavaScript 4.0 and 4.1 are primarily focused on 3D maps. It's a good idea to use ArcGIS API for JavaScript 3.18 especially if you are working with 2D maps.
... View more
10-11-2016
12:45 PM
|
0
|
4
|
1509
|
|
POST
|
I don't think you need to define a graphic within the SpatialReference. To use the spatialReference, include the module "esri/geometry/Extent" as follow: require(["esri/geometry/Extent"], function (Extent){ var extentInitial = new Extent ({ "xmin": , "ymin": , "xmax": , "ymax" : , "spatialReferece": { "wkid" : } }); The extent info is provide in your ArcGIS Server Manager from where you published you maps.
... View more
10-11-2016
10:52 AM
|
0
|
0
|
2402
|
|
POST
|
I have an app with multiple navigation tabs. All tabs except one refer to the maps that are in ArcGIS Server Manager. I have those maps as webmaps in Portal for ArcGIS on-premise. I used ArcGIS API for JavaScript to load those maps. I tried using web map ids but when each tab is clicked, it asks for the Portal credentials. I wanted to get rid of subsequent log ins, so I tried using the layers from ArcGIS Server Manager. Thanks Derek.
... View more
10-07-2016
07:10 AM
|
0
|
1
|
1175
|
|
POST
|
How can I use the Url from ArcGIS Server Manager to load a webmap using the ArcGIS API for JavaScript? I don't want to add each layers. I am trying to load the entire map without individually adding each layer.
... View more
10-06-2016
09:41 AM
|
0
|
4
|
2089
|
|
POST
|
I built an app that has multiple navigation tabs. Each tab refers to a map that resides in Portal for ArcGIS on-premise. The maps are displayed in the app using the ArcGIS API for JavaScript 3.18 using the esri/arcgis/utils AMD. When each tab is clicked, the page asks for the ArcGIS Portal credentials. I want the user to log in once on the main page and be able to view the maps without having to log into the Portal for ArcGIS account. How can I be able to do that? Thanks
... View more
10-05-2016
11:49 AM
|
0
|
0
|
1279
|
|
POST
|
I have an app created using ArcGIS API for JavaScript 3.18 and PHP. The app pulls the esri maps form Portal for ArcGIS. Can I register this kind of app in our own on-premise portal so that I can use OAuth to log into the app? Thanks
... View more
10-04-2016
02:15 PM
|
0
|
0
|
1290
|
|
POST
|
I have web maps created in Portal for ArcGIS and are shared within the organization. I am trying to bring those maps into my app using ArcGIS API for JavaScript. When I use the unique web map id, the map does not show up. However, if I use the map id of a map created in ArcGIS Online, the map shows up. require([
"esri/views/MapView",
"esri/WebMap",
"dojo/on",
"dojo/domReady!"
], function(
MapView, WebMap,
on
) {
var webmapids = [
"f2777e16f8734dc19321558bde5b26ba",
"71ba2a96c368452bb73d54eadbd59faa",
"45ded9b3e0e145139cc433b503a8f5ab"
];
/************************************************************
* Create multiple WebMap instances
************************************************************/
var webmaps = webmapids.map(function(webmapid) {
return new WebMap({
portalItem: {
id: webmapid
}
});
});
... View more
09-29-2016
09:56 AM
|
0
|
2
|
3609
|
|
POST
|
I have a table in SQL Server database. I created an "edit.php" where we can update the database. The database connection is established using PDO. The issue is: I have a lot of Null values in the table. When I click "Edit" option, the form pops out. If I completely fill the records, the database gets updated. Otherwise I get this error message. SQLSTATE[42000]: [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Error converting data type nvarchar to numeric. The codes for my edit.php are included below: require_once('database.php');
if (isset($_POST['btn_submit'])) {
$id = $_POST['txt_id'];
$site = $_POST['txt_site_code'];
$location = $_POST['txt_location_name'];
try {
$stmt = $conn->prepare("UPDATE MATRIX SET Site_Code=:site,
Location_name=:location WHERE OBJECTID =:id");
$stmt->execute(array(':site' => $site, ':location' => $location,':id' => $id));
if ($stmt) {
header('Location:index.php');
}
} catch (PDOException $e) {
echo $e->getMessage();
}
}
$object_id = '';
$site = '';
$location = '';
if (isset($_GET['id'])) {
$id = $_GET['id'];
$stmt = $conn->prepare("SELECT * FROM MATRIX WHERE OBJECTID=:id");
$stmt->execute(array(':id' => $id));
$row = $stmt->fetch();
$object_id = $row['OBJECTID'];
$site = $row['Site_Code'];
$location = $row['Location_name'];
}
?>
<h2>Edit the records</h2>
<form action="" method="post">
<table border="3px" cellpadding="5px">
<tr>
<td>Site Code</td>
<td><input type="text" name="txt_site_code" value="<?= $site; ?>"></td>
</tr>
<tr>
<td>Location Name</td>
<td><input type="text" name="txt_location_name" value="<?= $location; ?>"></td>
</tr>
<tr>
<td><input type="hidden" name="txt_id" value="<?= $object_id; ?>"></td>
<td><input type="submit" name="btn_submit" value="Submit"></td>
</tr>
</table>
</form> Thanks
... View more
09-01-2016
08:31 AM
|
0
|
4
|
8003
|
|
POST
|
I created two tables in SQL Server database in ArcGIS Desktop. I created a one-to-many relationship between the tables through their common column. I am creating an application in PHPStorm IDE and I am connected to my SQL Server database in ArcGIS desktop from PHPStorm. I can see the fields and records of the tables in PHPStorm but cannot see the relationship table that I created in SQL Server in ArcGIS. When I open the tables form ArcGIS desktop, only the fields are shown but the records(rows) are not there. Can anyone please explain what is going on here? Thanks
... View more
08-30-2016
08:32 AM
|
0
|
0
|
946
|
|
POST
|
We have a database in SQL Server platform in ArcGIS desktop. I am trying to connect to this database using PHP_PDO_SQLSRV. When I try this, I get a fatal error. The codes used to connect to the database: $serverName = 'SERVERNAME';
$connectionInfo=array('Database'=>'DATABASE', 'UID'=>'USERNAME', 'PWD' => 'PASSWORD');
$conn=sqlsrv_connect($serverName, $connectionInfo);
if($conn){
echo "Connection to SQL Server is successful! </br>";
}else{
echo "Connection failed! </br>";
die(print_r(sqlsrv_errors(),TRUE));
} I get the following error: Fatal error: Call to undefined function sqlsrv_connect() in the line $conn=sqlsrv_connect(); Could anyone please help me with this? Thanks
... View more
08-15-2016
12:18 PM
|
0
|
0
|
839
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 08-02-2017 12:54 PM | |
| 1 | 08-11-2017 12:04 PM | |
| 1 | 07-20-2017 06:45 AM | |
| 1 | 12-27-2016 11:28 AM | |
| 1 | 01-09-2018 07:36 AM |
| Online Status |
Offline
|
| Date Last Visited |
11-11-2020
02:25 AM
|