POST
|
I am using view.goTo to go to an array of geometries (which happen to be the same as all the polygons drawn on a graphics layer `graphicsLayerParcelHighlight`) The problem is that if I don't specify a zoom level, it's zoomed in too much. I want to back out around 2 or 3 zoom levels from whatever it would be otherwise. I think I could work out how to expand each of the geometries in the array, but I'm not sure if that's the most sensible way. I'm a beginner. view.whenLayerView(graphicsLayerParcelHighlight).then(() => { view.goTo({ target: parcelGeometryArray, zoom: 16 }); });
... View more
03-05-2024
08:06 PM
|
0
|
1
|
216
|
POST
|
I have an ArcGIS Developer account, so I can access a private feature layer in my account by adding it to the scopes on my API Key page. But my client has an ArcGIS Online Account, and the documentation states "API keys cannot be used with ArcGIS Online accounts to access private hosted layer (items) and data services.", so if I understand correctly, that method will not work for them. (And I wouldn't want to use this method in production anyway, since the API Key would provide indefinite access to read the private layer) I first attempted to solve this by getting an authentication token using my Client ID and Client Secret (server side), then passing this to my web application and assigning it to esriConfig.token (right below esriConfig.apiKey), but after removing the scope from the API Key settings, I am no longer able to load the private layer. Console message: "You do not have permissions to access this resource or perform this operation." I know that the token has sufficient privileges because I can put the feature layer URL in a web browser and add "?token=[the token]" and it grants me access. My questions: 1) How do I load a private feature layer using a token? Or is there a better way to load a private feature layer in an ArcGIS Online account (when the user of the web application is not an ArcGIS user)? 2) How can I limit the privileges of the token so it is read only and only for that one feature layer?
... View more
02-18-2024
10:53 AM
|
0
|
2
|
328
|
POST
|
I solved this by first using the Buffer geometry service with a negative distance to slightly reduce the size of the polygon. Then I use that result in my query. I would rather get it all done with one API call but if that's impossible, this is a good solution.
... View more
08-25-2022
12:21 PM
|
0
|
0
|
620
|
POST
|
Please refer to this query result: https://services2.arcgis.com/EFg39h3DBNzpxORa/ArcGIS/rest/services/Riverview_Zoning/FeatureServer/1/query?where=&objectIds=&time=&geometry=%7B%22rings%22%3A%5B%5B%5B2632869.44998882%2C7451399.60001902%5D%2C%5B2632863.4499898%2C7451422.60001523%5D%2C%5B2632896.49998436%2C7451431.25001381%5D%2C%5B2632902.54998337%2C7451408.30001758%5D%2C%5B2632869.44998882%2C7451399.60001902%5D%5D%5D%7D&geometryType=esriGeometryPolygon&inSR=&spatialRel=esriSpatialRelIntersects&resultType=none&distance=0.0&units=esriSRUnit_Meter&relationParam=&returnGeodetic=false&outFields=*&returnGeometry=false&returnCentroid=false&featureEncoding=esriDefault&multipatchOption=xyFootprint&maxAllowableOffset=&geometryPrecision=&outSR=&defaultSR=&datumTransformation=&applyVCSProjection=false&returnIdsOnly=false&returnUniqueIdsOnly=false&returnCountOnly=false&returnExtentOnly=false&returnQueryGeometry=false&returnDistinctValues=false&cacheHint=false&returnZ=false&returnM=false&returnExceededLimitFeatures=true&sqlFormat=none&f=html As you can see, this returns 2 polygons. The input geometry is represented by the teal rectangle in this picture. The results are the yellow polygon and the blue polygon. I do not want the blue polygon returned as it does not extend inside my input geometry. I tried setting the distance to -1 meters. I thought this would shrink the input geometry by 1m and therefore effectively require any query matches to extend at least 1m inside the provided boundary, but negative numbers in distance do not seem to have any effect. Is there any way to adjust my query so that it excludes such matches?
... View more
08-24-2022
11:47 AM
|
0
|
2
|
689
|
POST
|
I have the same problem and I don't understand how the suggested solution relates to the question... Edit: never mind - URL encoding (%26) works for me.
... View more
01-11-2021
12:21 PM
|
0
|
0
|
1640
|
POST
|
JS & ArcGIS newb here. I have a working example (thanks to this forum) that translates from an alternate spatial reference and plots a point on a map. As you can see from the commented out lines below - I am trying to adapt this to plot a path, but I'm not having luck. <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Basic Map</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.15/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.15/"></script>
<script>
//Style point
var simpleMarkerSymbol = {
type: "simple-marker",
color: [226, 119, 40], // orange
outline: {
color: [255, 255, 255], // white
width: 1
}
};
//style line
var simpleLineSymbol = {
type: "simple-line",
color: [226, 119, 40], // orange
width: 2
};
require([
"esri/Map",
"esri/views/MapView",
"esri/Graphic",
"esri/layers/GraphicsLayer",
"esri/geometry/Point",
"esri/tasks/GeometryService",
"esri/tasks/support/ProjectParameters",
"esri/geometry/SpatialReference"
], function(Map, MapView, Graphic, GraphicsLayer, Point, GeometryService, ProjectParameters, SpatialReference) {
var sr = new SpatialReference({
wkid: 2953
});
var map = new Map({
basemap: "topo-vector"
});
var graphicsLayer = new GraphicsLayer();
map.add(graphicsLayer);
var point = Point({
type: "point",
x: 2637779.94,
y: 7418399.63,
spatialReference: sr
});
var parcelOutline = {
type: "polyline",
paths: [[2637816.5,7418383.95],[2637788.4,7418370.9],[2637760.75,7418357.95],[2637743.65,7418416.45],[2637799.35,7418440.55],[2637816.5,7418383.95]],
spatialReference: sr
};
var geomSer = new GeometryService({url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer'});
var params = new ProjectParameters({
//geometries: [point],
geometries: [parcelOutline],
outSpatialReference: new SpatialReference({wkid:102100})
});
geomSer.project(params).then(function(results){
//var pointGraphic = new Graphic({
// geometry: results[0],
// symbol: simpleMarkerSymbol
//});
var parcelOutlineGraphic = new Graphic({
geometry: results[0],
symbol: simpleLineSymbol
});
var view = new MapView({
container: "viewDiv",
map: map,
center: results[0],
zoom: 13
});
//graphicsLayer.add(pointGraphic);
graphicsLayer.add(parcelOutlineGraphic);
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
09-13-2020
10:22 AM
|
0
|
1
|
313
|
POST
|
Perfect. What I ended up doing is specifying the WKID of my coordinates in the request so I don't need to worry about what the layer is using or do any conversions myself: [{
"attributes": {
"Operator": "Bob",
"Location": 123456789
},
"geometry": {
"spatialReference": {
"wkid": 4326
},
"x": -79.419591,
"y": 43.647131
}
}] Thanks again!
... View more
07-02-2020
09:21 AM
|
2
|
0
|
2702
|
POST
|
I'm close! I added a feature layer to my developer account and setup some fields. I am able to create features with attributes, BUT the point always goes to 0,0 off the coast of Africa... Here is my cURL, which I was expecting to place a point in Toronto: curl -X POST \
-d "f=json" \
-d "token=[theToken]" \
-d "features=[{\"attributes\":{\"Operator\":\"Bob\",\"Location\":123456789},\"geometry\":{\"x\":-79.419591,\"y\":43.647131}}]"
... View more
07-01-2020
04:30 PM
|
1
|
2
|
2702
|
POST
|
Thank you both. It may take me a day or two to get back into this, but even just knowing that what I was calling a "point" is a "feature" in the API gets me miles ahead. I was looking at the docs for "Items" and getting lost! I will come back soon to report my results. Thanks again!
... View more
06-30-2020
08:16 PM
|
1
|
0
|
2702
|
POST
|
I am a software developer but am new to mapping & ArcGIS. My client created a layer in their ArcGIS Online account using a file import. Each point on the map also includes a number of other fields from the database. Can the REST API be used to individually add a new point or update the information stored in an existing point? Or do I have to reference a URL where the complete table is available to be re-ingested? Thank you!
... View more
06-29-2020
10:38 AM
|
1
|
6
|
2856
|
POST
|
This is a big help, thank you! I'm now trying to specify my point as the map center. This is what I tried but I ended up in the ocean. <!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no">
<title>ArcGIS JavaScript Tutorials: Create a Starter App</title>
<style>
html, body, #viewDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
</style>
<link rel="stylesheet" href="https://js.arcgis.com/4.15/esri/themes/light/main.css">
<script src="https://js.arcgis.com/4.15/"></script>
<script>
//Style point
var simpleMarkerSymbol = {
type: "simple-marker",
color: [226, 119, 40], // orange
outline: {
color: [255, 255, 255], // white
width: 1
}
};
// Create attributes
var attributes = {
Name: "Area 51", // The name of the
Inspector: "Bob",
};
// Create popup template
var popupTemplate = {
title: "{Name}",
content: "Inspector Name <b>{Inspector}</b>."
};
require([
"esri/Map",
"esri/views/MapView",
"esri/Graphic",
"esri/layers/GraphicsLayer",
"esri/geometry/Point",
"esri/tasks/GeometryService",
"esri/tasks/support/ProjectParameters",
"esri/geometry/SpatialReference"
], function(Map, MapView, Graphic, GraphicsLayer, Point, GeometryService, ProjectParameters, SpatialReference) {
var sr = new SpatialReference({
wkid: 2953
});
var map = new Map({
basemap: "topo-vector"
});
var graphicsLayer = new GraphicsLayer();
map.add(graphicsLayer);
var point = Point({
type: "point",
x: 2665374.26,
y: 7435378.29,
spatialReference: sr
});
var geomSer = new GeometryService({url: 'https://sampleserver6.arcgisonline.com/arcgis/rest/services/Utilities/Geometry/GeometryServer'});
var params = new ProjectParameters({
geometries: [point],
outSpatialReference: new SpatialReference({wkid:102100})
});
geomSer.project(params).then(function(geom){
var pointGraphic = new Graphic({
geometry: point,
symbol: simpleMarkerSymbol,
attributes: attributes,
popupTemplate: popupTemplate
});
var view = new MapView({
container: "viewDiv",
map: map,
center: point,
zoom: 13
});
graphicsLayer.add(pointGraphic);
});
});
</script>
</head>
<body>
<div id="viewDiv"></div>
</body>
</html>
... View more
06-23-2020
08:08 AM
|
0
|
1
|
547
|
POST
|
I'm working from the tutorial here: Display point, line, and polygon graphics | ArcGIS for Developers And wondering how to adapt this if my coordinates are in a different spatial reference. I have the wkid. Thank you!
... View more
06-22-2020
02:17 PM
|
0
|
3
|
730
|
Title | Kudos | Posted |
---|---|---|
1 | 07-01-2020 04:30 PM | |
1 | 06-29-2020 10:38 AM | |
2 | 07-02-2020 09:21 AM | |
1 | 06-30-2020 08:16 PM |
Online Status |
Offline
|
Date Last Visited |
03-06-2024
06:55 PM
|