|
POST
|
That's expected. So you want to show the vertices of the polygon as points? You'll need to break it down to points using something like the explode utility I linked above. Polygons -> Polylines -> Points
... View more
07-26-2022
07:39 AM
|
0
|
0
|
1069
|
|
POST
|
require(["esri/config","esri/views/MapView", "esri/WebMap"],
(esriConfig, MapView, WebMap) => {
// you are overriding the esriConfig object you imported
// var esriConfig = {
// portalUrl: "https://domain/portal/home/",
// };
esriConfig.portalUrl = "https://domain/portal/home/";
const webmap = new WebMap({
portalItem: {
// autocasts as new PortalItem()
id: "c1127b4c1e3e4ab9bd3005192f6e6731"
}
});
const view = new MapView({
map: webmap,
container: "viewDiv"
});
}); Or if you want to make the esriConfig global, you can do this. You don't need to import or reference it in your own JavaScript if you do this. <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Testing</title>
<style>
#viewDiv {
height: 100%;
width: 100%;
margin: 0;
padding: 0;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.24/esri/themes/dark/main.css" />
<script>
// If ou define it globally here
// the API will pick it up.
// But should be in the head
// so it is created before the API
var esriConfig = {
portalUrl: "https://domain/portal/home/",
};
</script>
</head>
<body>
<div id="viewDiv"></div>
<script src="https://js.arcgis.com/4.24/"></script>
<!-- Do not add the esriConfig your JavaScript if you do this -->
<script src="js/test_main.js"></script>
</body>
</html>
... View more
07-25-2022
02:45 PM
|
1
|
2
|
4738
|
|
POST
|
if you are going to use the esriConfig global object, you need to put it in a script tag above the one that imports the map modules. Or you can import the esriConfig like you did and set the portalUrl on it You can't do both in the same script tag
... View more
07-25-2022
01:44 PM
|
0
|
4
|
4750
|
|
POST
|
Set the portalUrl of the esriConfig object you import, you're creating a new object and overwriting the default one. https://developers.arcgis.com/javascript/latest/api-reference/esri-config.html#portalUrl esriConfig.portalUrl = "https://myHostName.esri.com/arcgis"
... View more
07-25-2022
01:17 PM
|
0
|
6
|
4769
|
|
POST
|
Do you want to render the vertices of the polygon to points? Or the center of the polygons to points? You would need to break the polygon into polylines and the polylines into points. I have a utility you can use for that. https://github.com/odoe/explode/ For the render to polygon to points, you can define the renderer to display points and it will use the centroid of the polygon. https://developers.arcgis.com/javascript/latest/api-reference/esri-renderers-SimpleRenderer.html The center can be a little off if it's an oddly shaped polygon, like a horse shoe or something.
... View more
07-25-2022
08:14 AM
|
0
|
0
|
1090
|
|
POST
|
FeatureLayers, by design with a FeatureService can only have a single geometry type. https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#geometryType So if you have points, lines, polygons, you need a FeatureLayer for each.
... View more
07-22-2022
08:26 AM
|
0
|
0
|
1160
|
|
POST
|
Ok, I think you need to simplify your sample a bit to get to the bare minimum and work up from there. Looks like I was incorrect about removing graphics from the graphicsLayer used by SketchViewModel. If you no longer want to use them in a Sketch, you can remove them, but if you still want to see them, you need move to another graphicsLayer not used by Sketch. There's some snippets using this pattern for when you use sketch.create(), but you are sketching your own graphics with sketch.update(), so it's slightly different, as you provided the graphic for the SketchViewModel. Here is a super simple sample showing how to sketch a given graphic, and finish the sketch. https://codepen.io/odoe/pen/abYWVaK?editors=0010 I think in your previous example, you are trying to delete things before completing the Sketch action and that's causing issues. // on click, stop the sketch actions
sketchBtn.addEventListener("click", () => {
// if the sketch is currently active
// we can complete the action
if (sketchViewModel.state === "active") {
sketchViewModel.complete();
}
});
sketchViewModel.on("update", (event) => {
// this fires after sketchViewModel.complete()
if (event.state === "complete") {
// you do need to remove graphics from
// the grapicsLayer so they are not part
// sketch updates
graphicsLayer.removeMany(event.graphics);
// move it to another graphics layer
// so I can still see it, but not sketch it
// anymore
view.graphics.addMany(event.graphics);
}
});
const clickHandle = view.on("click", ({ mapPoint }) => {
clickHandle.remove();
const graphic = new Graphic({
geometry: mapPoint
});
graphicsLayer.add(graphic);
sketchViewModel.update(graphic, {
tool: "move"
});
});
... View more
07-20-2022
07:02 PM
|
1
|
0
|
3581
|
|
POST
|
Technically, this is what the Editor widget is for. But if you really wanted to, you could pass the graphics from the Sketch widget into the featureLayer.applyEdits, but kind of seems like the long way to get there. Plus you would need to populate the attributes in some way. You would need a separate FeatureLayer per geometry type as well.
... View more
07-20-2022
08:40 AM
|
0
|
2
|
1176
|
|
POST
|
What does the print service parameters page look like? I didn't know you could specify a custom image parameter in the publishing tools for layouts, but knowing what it expects would help.
... View more
07-20-2022
08:36 AM
|
0
|
0
|
1388
|
|
POST
|
Have not seen anything reported as of yet that could lead to this. Does it look correct in the MapViewer? Is this a WebMap you can share? I assume this is a WebMap, idk. Can't tell. API version? Online or Enterprise (version)? If we can't help you here, you can submit a support ticket with the application to them to get get it into the support pipeline.
... View more
07-19-2022
08:31 PM
|
0
|
0
|
566
|
|
POST
|
Depending on what your print service is expecting, you can send them as extraParameters in the PrintParameters. https://developers.arcgis.com/javascript/latest/api-reference/esri-rest-support-PrintParameters.html#extraParameters
... View more
07-19-2022
10:51 AM
|
0
|
0
|
1397
|
|
POST
|
I have a sample that moves a graphic on the "hold" event. You can tweak it to use applyEdits too. https://codepen.io/odoe/pen/bLEroK
... View more
07-19-2022
10:29 AM
|
0
|
0
|
891
|
|
POST
|
Is miseservice an array? Too tough to tell from a screenshot, but sounds like that property is not an array you can map over
... View more
07-19-2022
10:23 AM
|
0
|
0
|
1179
|
|
POST
|
Custom Search sources are going to vary based on what third-party API you are using. So you need to be familiar with the parameters that API needs. The samples are using the esriRequest to make the queries, but you don't have to. You can use native fetch, or axios, or any other request style library you are comfortable with. https://developers.arcgis.com/javascript/latest/api-reference/esri-request.html The ?q= is created by esriRequest, because that is how the sample API needs to be parsed. Your API is different. The %2F comes from url encoding. Without going into detail, this is how URL requests get encoded to escape special characters. This is standard. This was specific to the sample API being used, your API will require different parameters. Your API doesn't need the lat/lon parameters, so you can omit them. The sourceIndex is the index of the search source being referenced. This is given to you in the parameters of the getSuggestions method. https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html#GetSuggestionsParameters The power of using custom search sources is that you can transform any searchable third-party API into something that be used by the Search widget, meaning each API will need to handled on a case by case basis. The API parameters will differ, the results will differ, but as long as you transform those results into something the ArcGIS JSAPI expects, you can make it work. This Swiss search API can return GeoJSON results, so that makes it a little easier to work with, but you need to specify the spatial reference as well. Here is an update to your app that uses the parameters as described in that search API doc and seems to work correctly. https://codepen.io/odoe/pen/QWmpVdQ?editors=0011
... View more
07-19-2022
10:03 AM
|
1
|
0
|
2809
|
|
POST
|
The main things you need to write are a getSuggestions and getResults method. https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search-SearchSource.html That API looks like it takes a searchText and limit, so you can use that for the suggestions. You need to transform those into a SuggestResult, with key, text, and sourceIndex. https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#SuggestResult The getResults should return an array of SearchResults https://developers.arcgis.com/javascript/latest/api-reference/esri-widgets-Search.html#SearchResult
... View more
07-18-2022
01:33 PM
|
0
|
2
|
2822
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 3 weeks ago | |
| 2 | 3 weeks ago | |
| 1 | 02-27-2026 06:31 AM | |
| 1 | 01-13-2026 02:15 PM | |
| 1 | 12-31-2025 09:05 AM |
| Online Status |
Online
|
| Date Last Visited |
7 hours ago
|