POST
|
Hi everyone! I would like to send a file in the request, not from client, but directly from server. Is it possible? request("https://www.arcgis.com/sharing/rest/content/features/generate", {
query: myContent,
body: myFile, // handle to file from server
responseType: "json"
})
... View more
03-26-2020
04:33 AM
|
0
|
0
|
343
|
POST
|
I changed symbol AFTER create / update: sketch.on('create', function(event) {
if (event.state === 'complete') {
event.graphic.symbol=my_symbol;
...
}
} But how to change default geometry symbol while drawing? I mean this blue dashed and grey lines.
... View more
08-25-2019
12:19 PM
|
1
|
2
|
702
|
POST
|
Yeah! I did it! If someone would to copy this is all the code: JS Bin - Collaborative JavaScript Debugging
... View more
08-21-2019
02:05 PM
|
0
|
0
|
1147
|
POST
|
It helps a lot! I also played with sketch.on("update", function(event){
...
} but I realised that I really don't need to know about every single change. I only want to save done work. It should be like this: user is adding / changing / deleting shapes then click the button "Save my work" program gather all geometries, convert to JSON or string add to database How to do that? Is it possible?
... View more
08-19-2019
05:53 AM
|
0
|
1
|
1147
|
POST
|
Thank you for comment, I saw this method, but I still don't know how to get geometries? In 3.21 version I used this code: function addGraphic(evt) {
//deactivate the toolbar and clear existing graphics
tb.deactivate();
map.enableMapNavigation();
// figure out which symbol to use
var symbol = fillSymbol;
map.graphics.add(new Graphic(evt.geometry, symbol));
var obj=evt.geometry.rings;
var poly_cords="";
for ( var path = 0; path <obj.length; path ++ ) {
//For each point in the path...
for ( var pt = 0; pt < obj[path].length; pt++ ) {
poly_cords+=obj[path][pt][0].toFixed(1)+', ';
poly_cords+=obj[path][pt][1].toFixed(1)+' \n';
}
poly_cords+='---\n';
}
document.getElementById('cords').value += poly_cords;
} Now I even try: sketch.on("draw-end", addGraphic);
function addGraphic(evt) {
console.log("WORKS!");
} but still nothing 😞 How can I get it?
... View more
08-18-2019
02:02 PM
|
0
|
1
|
1147
|
POST
|
Hi everyone! I've got a code: JS Bin - Collaborative JavaScript Debugging, I can mark something, but how can I save my work so I could use it later? I would be great to have it in JSON format. Could someone help me?
... View more
08-17-2019
11:13 AM
|
0
|
6
|
1292
|
POST
|
I mean here: https://developers.arcgis.com/javascript/3/jssamples/ or https://developers.arcgis.com/javascript/latest/sample-code/index.html
... View more
11-06-2017
01:42 PM
|
0
|
0
|
251
|
POST
|
Thanks boys!!! You helped me a lot. Maybe someone could add these files as an example? I think they may be useful to others in the future Show a map and polygon on it Add polygon to map by Toolbar
... View more
11-06-2017
01:37 PM
|
0
|
1
|
251
|
POST
|
I emigrated to v4.5, did as simple as possible, but isn't work. I do not understand this. I just want to use a basemap, add some polygons and that's it. Must it be so complicated? :'-( <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Map</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.5/esri/css/main.css">
<script src="https://js.arcgis.com/4.5/"></script>
<script>
require([
"esri/Basemap",
"esri/Map",
"esri/views/MapView",
"dojo/domReady!"
], function(Basemap, Map, MapView){
var myBasemap = new Basemap({
baseLayers: [{
url: "https://www.maps.lt/arcgis/rest/services/mapslt/MapServer"
}],
thumbnailUrl: "https://www.example.com/images/thumbnail_2014-11-25_61051.png",
title: "Custom Basemap",
id: "myMap"
});
var map = new Map({
basemap: myBasemap
});
var view = new MapView({
container: "viewDiv", // Reference to the scene div created in step 5
map: map, // Reference to the map object created before the scene
center: [54, 23] // Sets center point of view using longitude,latitude
zoom: 4, // Sets zoom level based on level of detail (LOD)
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
10-22-2017
02:24 PM
|
0
|
2
|
1442
|
POST
|
Wow, you helped me a lot! Thank you! But why the map isn't in the center? No matter I'm writing in: basemap: "myCustomBasemap", center: [23.354527,54.556371], zoom:5 nothing happens 😞
... View more
10-13-2017
02:58 PM
|
0
|
1
|
1442
|
POST
|
Didn't help. The problem is: when added new layer, I can't add new polygon (click on button).
... View more
10-12-2017
04:23 AM
|
0
|
0
|
1442
|
POST
|
Hello, i'm trying to use MapImageLayer instead of basemap, but it doesn't work. <!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>Map Edit</title>
<link rel="stylesheet" href="https://js.arcgis.com/3.21/esri/css/esri.css">
<style>
#info {
top: 20px;
color: #444;
height: auto;
font-family: arial;
right: 20px;
margin: 5px;
padding: 10px;
position: absolute;
width: 115px;
z-index: 40;
border: solid 2px #666;
border-radius: 4px;
background-color: #fff;
}
html, body, #mapDiv {
padding:0;
margin:0;
height:100%;
}
button {
display: block;
}
</style>
<script src="https://js.arcgis.com/3.21/"></script>
<script>
var map, tb;
require([
"esri/map",
"esri/layers/MapImageLayer",
"esri/toolbars/draw",
"esri/symbols/SimpleMarkerSymbol", "esri/symbols/SimpleLineSymbol",
"esri/symbols/PictureFillSymbol", "esri/symbols/CartographicLineSymbol",
"esri/graphic",
"esri/geometry/webMercatorUtils",
"esri/Color", "dojo/dom", "dojo/on", "dojo/domReady!"
], function(
Map, MapImageLayer,Draw,
SimpleMarkerSymbol, SimpleLineSymbol,
PictureFillSymbol, CartographicLineSymbol,
Graphic, webMercatorUtils,
Color, dom, on
) {
map = new Map("mapDiv", {
basemap: "osm",
center: [23.354527,54.556371],
zoom:14
});
/* DOESN'T WORK
var layer = new MapImageLayer({
url: "https://www.maps.lt/arcgis/rest/services/mapslt/MapServer"
});
map.add(layer);
var view = new MapView({
container: "viewDiv",
map: map,
center: [23.675000, 54.665000],
zoom: 14
});
*/
map.on("load", initToolbar);
// lineSymbol used for freehand polyline, polyline and line.
var lineSymbol = new CartographicLineSymbol(
CartographicLineSymbol.STYLE_SOLID,
new Color([255,0,0]), 10,
CartographicLineSymbol.CAP_ROUND,
CartographicLineSymbol.JOIN_MITER, 5
);
// fill symbol used for extent, polygon and freehand polygon, use a picture fill symbol
// the images folder contains additional fill images, other options: sand.png, swamp.png or stiple.png
var fillSymbol = new PictureFillSymbol(
"images/mangrove.png",
new SimpleLineSymbol(
SimpleLineSymbol.STYLE_SOLID,
new Color('#000'),1
), 42, 42
);
function initToolbar() {
tb = new Draw(map);
tb.on("draw-end", addGraphic);
// event delegation so a click handler is not
// needed for each individual button
on(dom.byId("info"), "click", function(evt) {
if ( evt.target.id === "info" ) {
return;
}
var tool = evt.target.id.toLowerCase();
map.disableMapNavigation();
tb.activate(tool);
});
}
function addGraphic(evt) {
//deactivate the toolbar and clear existing graphics
tb.deactivate();
map.enableMapNavigation();
// figure out which symbol to use
var symbol = fillSymbol;
map.graphics.add(new Graphic(evt.geometry, symbol));
evt.geometry = webMercatorUtils.webMercatorToGeographic(evt.geometry);
var obj=evt.geometry.rings;
punkty="";
for ( var path = 0; path <obj.length; path ++ ) {
//For each point in the path...
for ( var pt = 0; pt < obj[path].length; pt++ ) {
punkty+=obj[path][pt][0].toFixed(6)+' \n';
punkty+=obj[path][pt][1].toFixed(6)+' \n';
}
punkty+='#\n';
}
document.getElementById('cords').value += punkty;
}
});
</script>
</head>
<body>
<div id="info">
<button id="Polygon">New polygon</button>
</div>
<div id="mapDiv"></div>
</body>
</html>
I want to have only one basemap (MapsLT/MapServer), but if will be added layer, will be ok. It is possible to do thist? If yes - how to do this?
... View more
10-12-2017
04:00 AM
|
0
|
12
|
3431
|
POST
|
Hello, i'm trying add label to polygon. Something gone wrong and polygon's label doesn't show up. I took a example from: https://developers.arcgis.com/javascript/3/sandbox/sandbox.html?sample=util_label_point Can anybody explain me where problem/ bug is? <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Map test</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.3/esri/css/main.css">
<script src="https://js.arcgis.com/4.3/"></script>
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/MapImageLayer",
"esri/Graphic",
"esri/tasks/GeometryService",
"esri/geometry/Point",
"esri/symbols/SimpleMarkerSymbol",
"esri/geometry/Polyline",
"esri/symbols/SimpleLineSymbol",
"esri/symbols/Font",
"esri/symbols/TextSymbol",
"esri/geometry/Polygon",
"esri/symbols/SimpleFillSymbol",
"dojo/domReady!"
], function(Map, MapView, MapImageLayer,
Graphic, GeometryService,
Point, SimpleMarkerSymbol,
Polyline, SimpleLineSymbol, Font, TextSymbol,
Polygon, SimpleFillSymbol
) {
var layer = new MapImageLayer({
url: "https://www.maps.lt/arcgis/rest/services/mapslt/MapServer"
});
var map = new Map({
basemap: "topo"
});
geometryService = new GeometryService("https://utility.arcgisonline.com/ArcGIS/rest/services/Geometry/GeometryServer");
var view = new MapView({
container: "viewDiv",
map: map,
center: [23.5454615,54.569436],
zoom: 16
});
// Create a symbol for rendering the graphic
var sym = new SimpleFillSymbol({
color: [255, 0, 0, 0.1],
outline: {
color: [255, 0, 0],
width: 1
}
});
var polygon1 = new Polygon({
rings: [
[23.545460, 54.569436],
[23.545463, 54.568627],
[23.545120, 54.568618],
[23.545109, 54.569436],
[23.545460, 54.569436]]});
var polygonGraphic1 = new Graphic({geometry: polygon1, symbol: sym});
view.graphics.add(polygonGraphic1);
var geometries=[polygonGraphic1];
//----- NOT WORKING ----------
geometryService.labelPoints(geometries, function(labelPoints) { // callback
var font = new Font("20px", Font.STYLE_NORMAL, Font.VARIANT_NORMAL, Font.WEIGHT_BOLDER);
array.forEach(labelPoints, function(labelPoint) {
var textSymbol = new TextSymbol("foo", font, new Color([0, 0, 0]));
var labelPointGraphic = new Graphic(labelPoint, textSymbol);
view.graphics.add(labelPointGraphic);
});
});
// ---------------------------
map.add(layer);
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
09-20-2017
01:32 PM
|
0
|
1
|
911
|
Title | Kudos | Posted |
---|---|---|
1 | 08-25-2019 12:19 PM |
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|