|
POST
|
I started messing around with the CSS, and then the Map and MapView setup just to see if it wasn't set to something that worked. But then I noticed that in the Require call you had 'Map' at the end, but it was the first javascript library call. I switched that so that 'Map' was at the beginning and it is working, at least for the basemap. Not sure about your layers and graphics. Here is what I was tinkering with: <!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>Demo</title>
<link rel="stylesheet" href="https://js.arcgis.com/4.20/esri/themes/light/main.css">
<style>
html, body, #mapDiv {
padding: 0;
margin: 0;
height: 100%;
width: 100%;
}
#textbox {
background-color: #fff;
box-shadow: 0 0 5px #888;
font-size: 1.1em;
max-width: 15em;
padding: 0.5em;
position: absolute;
right: 20px;
top: 20px;
z-index: 40;
}
</style>
<script src="https://js.arcgis.com/4.20/"></script> <!--wrong version?-->
<script>
require([
"esri/Map",
"esri/views/MapView",
"esri/layers/FeatureLayer",
"esri/Graphic",
"esri/symbols/SimpleFillSymbol",
"esri/symbols/SimpleLineSymbol",
"esri/Color",
"esri/geometry/Circle",
"esri/rest/support/Query",
"esri/geometry/Point",
"esri/layers/GraphicsLayer"
], function(
Map, MapView, FeatureLayer, Graphic, SimpleFillSymbol, SimpleLineSymbol, Color, Circle, Query, Point, GraphicsLayer
) {
const feedlotFL = new FeatureLayer({
url: "https://arcgis.dnr.state.mn.us/arcgis/rest/services/ewr/practicum_feedlot/MapServer/0",
outFields: ["*"]
});
// Selected feedlots
const selectedFeedlotsGL = new GraphicsLayer();
// Map
const feedlotMap = new Map({
basemap: "topo-vector", //wrong basemap type?
layers: [feedlotFL, selectedFeedlotsGL]
});
// View
const mapView = new MapView({
container: "mapDiv",
map: feedlotMap,
center: [-99.1, 35.5],
zoom: 9
});
mapView.on("click", evt => {
// TODO: Clear the graphics
const circleSymb = new SimpleFillSymbol(SimpleFillSymbol.STYLE_NULL,
new SimpleLineSymbol(SimpleLineSymbol.STYLE_SHORTDASHDOTDOT,
new Color([0, 0, 0]),2),
new Color([255, 255, 0, 0.25])
);
// Buffer type
const circle = new Circle({
center: evt.mapPoint,
radius: 25,
// geodesic: true,
radiusUnit: "feet"
});
const bufferGraphic = new Graphic(circle, circleSymb);
mapView.graphics.add(bufferGraphic);
let query = new Query({
geometry: mapView.toMap(evt),
distance: 25,
units: "feet",
spatialRelationship: "intersects",
returnGeometry: true,
outFields: ["*"]
});
feedlotFL.queryFeatures(query).then(response => {
document.getElementById('textbox').innerHTML = "<b>The number of feedlots within the buffer is <i>" + feedlotCount + "</i>.</b>"
const selectedFeedlots = [];
for (let i = 0; i < feedlotCount; i++) {
selectedFeedlots.push(response.features[i]);
}
addGraphics(selectedFeedlots);
function addGraphics(feedlots) {
feedlots.forEach(function(feature){
const eachSelectedFeedlotPt = new Graphic({
geometry: feature.geometry,
symbol: {
type: "simple-marker",
color: [0,0,0],
outline: {
width: 2,
color: [0,255,255],
},
size: "10px"
},
});
selectedFeedlotsGL.add(eachSelectedFeedlotPt);
});
}
});
});
});
</script>
</head>
<body>
<span id="textbox">Click on the map to select feedlots within 10 miles</span>
<div id="mapDiv"></div>
</body>
</html>
... View more
09-08-2021
08:17 AM
|
0
|
0
|
1390
|
|
POST
|
Yes, I mean going to the service on ArcGIS Online or your own Portal server and setting the Popup look and feel there. I'm sure there's a way to do it through the API but I've never done that since it is so easy to do it this way.
... View more
09-07-2021
08:18 AM
|
0
|
0
|
1126
|
|
POST
|
Style your popup by configuring the popup in the ArcGIS Service and choosing 'A custom attribute display'. Then use the 'Configure' button to enter your own html. I haven't found an easy to add CSS classes, but you can use inline styles to get what you want, such as: <p style="font-size: 1.1em; color: #0e4f49;">Located at {expression/expr8}, {expression/expr9}, light rail station <span style="text-decoration: underline;">{StationName}</span> is currently <span style="text-decoration: underline;">{StationStatus}</span>.</p>
<table border="1" style="width: 191px; color: #ffffff; background-color: #177c72; border-color: #ffffff;">
<tbody>
<tr>
<td style="width: 71px; background-color: #12635b;"><strong>Benches</strong></td>
<td style="width: 10px;">{expression/expr0}</td>
<td style="width: 69px; background-color: #12635b;"><strong>Restroom</strong></td>
<td style="width: 29px;">{expression/expr4}</td>
</tr>
<tr>
<td style="width: 71px; background-color: #12635b;"><strong>Bike Racks</strong></td>
<td style="width: 10px;">{expression/expr1}</td>
<td style="width: 69px; background-color: #12635b;"><strong>TVM</strong></td>
<td style="width: 29px;">{expression/expr5}</td>
</tr>
</tbody>
</table>
<p style="font-size: 0.8em;"><a href="{Image}" rel="nofollow ugc" target="_blank"><img alt="Station photo" height="150" src="{Image}" width="200" /></a></p>
<p style="font-size: 0.8em;"></p>
... View more
09-07-2021
08:09 AM
|
0
|
0
|
1131
|
|
POST
|
Everything that's publicly available is free to a point. Look at this page for some more info https://developers.arcgis.com/pricing/
... View more
08-27-2021
09:53 AM
|
0
|
0
|
1945
|
|
POST
|
These are 'free' services. Again, it's up to the owner (Esri) in this case as to if they will have any issues with a large number of hits. I would imagine that these already get a lot of hits, but if you are creating so many hits that they have to push out another cloud server (or 2, or 3?) then it might become more of an issue. If it was my server and that happened (and it was bogging my service down), I might just move the service often enough that you can't have an app consistently pointed to it. I would imagine that if it causes Esri too much money they would figure out how to stop your app from hitting their service(s). You can do it and ask for forgiveness later, or send them an email directly and decide if needs some form of payment over what is offered for free. Maybe someone from Esri will answer this thread, but since it's mainly more from a technical side I would think not, or maybe they are passing it on to the sales/engineering group. If it was me I would ask forgiveness later, but you risk having it impact your app (if it's too many hits). Again, your call, but good luck.
... View more
08-27-2021
09:39 AM
|
0
|
1
|
1952
|
|
POST
|
I don't know about developing for iOS, but if you can get Javascript to work in your environment then you can use the API. You can also download the API which isn't that huge (not sure about where you will store it) so that you aren't having to download it each time a user hits your app. I'd be more concerned with the online map that you'll have to be hitting. That data will have to be hit each time the users access a map, and if any online analysis gets done that will need credits against some online account. There are a lot of 'free' public maps to use, but if it's not your account millions (billions?) of hits a day could derail your desires to not pay for anything.
... View more
08-27-2021
09:04 AM
|
0
|
1
|
1958
|
|
POST
|
Just like in the example, you are going to have to use the drawn box (polygon) and do a 'featureLayer.queryFeatures' on all of the layers that you add to your map. The hard part is going to be what you do with it afterwards, as I believe the FeatureTable that's being used can only attach to one featureLayer at a time. You could get the results for each featurelayer, push them into one JSON string, and then use something like Dojo's 'dGrid' to display them, that would be a lot of work but you would have full control over it. You could also take each result and write out the table in HTML (<table><tr><td>fieldname</td><td>field value</td></tr></table>) and stuff it back into the page. If you have access to the new Experience Builder, you could create a page with a map, add all of your layers, and then add the Table widget which can show the results of all of the feature layers with a nice way to select each one. That would be my recommendation, but again, you need access to Experience Builder.
... View more
08-26-2021
08:02 AM
|
1
|
1
|
1556
|
|
POST
|
Nothing yet. It was submitted on 3/28/2021. I can try to escalate it and see what happens.
... View more
08-20-2021
08:26 AM
|
0
|
0
|
1876
|
|
POST
|
That looks like it will work, at least it's what Esri shows in its examples. My guess is that your feature class isn't set up to be time aware. Maybe look at this, not for the part about Web App Builder, but in how to setup time-enabled layers. https://support.esri.com/en/technical-article/000024856
... View more
08-12-2021
03:06 PM
|
0
|
1
|
2339
|
|
POST
|
I thought that this depended on what the REST service is setup to allow, and it defaults to 1000. So if it's your service and you have access to ArcGIS Manager you can allow more, but if not you are only able to ever get up to the 1000 limit. I have written code in the past to consume some one else's service that was limited to 1000 features, but I had to pull it in in groups, or hope that you can write a where clause for the query that comes in under 1000.
... View more
08-06-2021
08:38 AM
|
1
|
0
|
3930
|
|
POST
|
Doesn't make sense why it won't work. The API reference for MapView says the 'extent' is just an Extent object with xmax, xmin, ymax, ymin, center, and spatialReference which it has. Maybe there needs to be a conversion to a jimuMapView.extent, or maybe import the ArcGIS API Extent object and set a new one equal to extentRectangle.extent, then use that. Seems unnecessary but it's all I can think of.
... View more
08-02-2021
01:28 PM
|
0
|
0
|
4673
|
|
POST
|
I'm not using Jimu, but since jimuMapView.view equates to an ArcGIS Javascript View, I would just use 'extent', as in this.state.jimuMapView.view.extent = extentRectangle.
... View more
07-30-2021
01:37 PM
|
1
|
1
|
4706
|
|
POST
|
That sounds like a lot of data, 24 (samples) X 365 (days in a year) X 2 (years) X ? (number of points). Displaying this on a map always depends on what you want to show your audience, but anything you do will probably be an aggregation of this into something more meaningful. Maybe you can derive an average demand per point over a time frame (week, month, year, season) and just show it in a hot spot map to generalize where the highest demands are. Or you could generate averages for say one season (Spring, Winter, Fall, Summer) and show differences between other season(s). Or you could look at the demand over a 24 hour period and determine the peak demand times, and then maybe average that over time and location. Not knowing your data, but maybe you have other concentration (population, shopping, ?) that you want to determine the demand strength as you move away from them (in distance), which I'm thinking Kriging might be something to look into. This is just off the top of my head as I've never worked with demand data, but it all really comes down to what are you trying to say/show to your target audience. Happy sleuthing!
... View more
07-30-2021
09:33 AM
|
0
|
0
|
1351
|
|
POST
|
I think you can do exactly what you are talking about using the 'View.on("click"' and the 'hittest' to get selected features, like this: // Set up function to collect location if view is clicked
view.on("click", (event) => {
// Pull selected features if any
view.hitTest(event).then((response) => {
var results = response.results;
if (results.length > 0) {
for (var i = 0; i < results.length; i++) {
console.log(results[i]);
}
}
}
}
... View more
07-22-2021
03:46 PM
|
1
|
1
|
1328
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 11-01-2022 02:02 PM | |
| 1 | 02-28-2024 01:40 PM | |
| 2 | 02-27-2024 01:13 PM | |
| 1 | 10-18-2022 11:31 AM | |
| 1 | 06-23-2023 09:13 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-28-2025
09:15 AM
|