|
POST
|
Geometries are immutable so you can't move them. Instead you just create a new one and its very easy to apply a new geometry to an existing graphic and hence move it. I've had a go at this using a point and a polygon which I've also created with ellipseGeodesic. It looked like this: My app had some class members to track my ship private GraphicsOverlay dynamicGraphicsLayer;
private double xPos=0, yPos=0; // current location of my ship
private Graphic shipGraphic; // graphic for ship
private Graphic shipBufferGraphic; // graphic for buffer around ship A method to create my buffer / ellipse public Polygon generateBuffer(Point shipPosition) {
Polygon buffer = null;
GeodesicEllipseParameters parameters = new GeodesicEllipseParameters();
parameters.setCenter(shipPosition);
parameters.setSemiAxis1Length(500);
parameters.setSemiAxis2Length(500);
parameters.setMaxSegmentLength(5);
buffer = (Polygon) GeometryEngine.ellipseGeodesic(parameters);
return buffer;
} The initial position was drawn like this: // create a dynamic graphics layer
dynamicGraphicsLayer =
new GraphicsOverlay(GraphicsOverlay.RenderingMode.DYNAMIC);
mapView.getGraphicsOverlays().add(dynamicGraphicsLayer);
// symbols
SimpleLineSymbol bufferSymbol =
new SimpleLineSymbol(SimpleLineSymbol.Style.SOLID, 0xFF00FF00, 3);
SimpleMarkerSymbol shipSymbol =
new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFFFF0000, 10);
// geometries
Point shipPosition = new Point(xPos,yPos, SpatialReferences.getWebMercator());
Polygon shipBuffer = generateBuffer(shipPosition);
// initial graphics showing ship and buffer
shipGraphic = new Graphic(shipPosition, shipSymbol);
shipBufferGraphic = new Graphic(shipBuffer, bufferSymbol);
// adding graphics to graphics layer
dynamicGraphicsLayer.getGraphics().add(shipGraphic);
dynamicGraphicsLayer.getGraphics().add(shipBufferGraphic); Then I had a button on my app to move the position of the ship slightly Button addGraphics = new Button("move ship");
addGraphics.setOnAction(event -> {
// move the ship
xPos = xPos + 50;
yPos = yPos + 50;
Point newLocation = new Point(xPos, yPos, SpatialReferences.getWebMercator());
// update the graphics location
moveShip(newLocation);
}); Which in turn calls this simple code to apply the new geometries to your existing graphics public void moveShip(Point newLocation) {
shipGraphic.setGeometry(newLocation);
shipBufferGraphic.setGeometry(generateBuffer(newLocation));
} This is a very common workflow and even if you use it for updating thousands of graphics it works well. Does this help?
... View more
11-03-2020
11:47 AM
|
1
|
3
|
5486
|
|
POST
|
The OpenGL Context creation issue was fixed in 100.9 so you need to get to the reason why this is not working for you. Have you switched to using AndroidX? Have you tried running a simple sample like this to see if the API works on your device? arcgis-runtime-samples-android/java/display-map at master · Esri/arcgis-runtime-samples-android · GitHub It is best that you continue this conversation on the other thread or create a new one and we will help you. The only answer to the context creation issue is to use 100.9.
... View more
11-02-2020
08:55 AM
|
0
|
0
|
6142
|
|
POST
|
Can you tell me what version of the SDK you are using? I'm aware of this issue in earlier versions, but I do believe this was fixed in 100.9... however if you can tell me the version you are experiencing this and the full details of the device this will help.
... View more
11-02-2020
01:00 AM
|
0
|
2
|
6142
|
|
POST
|
There are a couple of approaches you could take to this. One way would be to use Local Server to run a geoprocessing tool to create it for you. I can see that fishnet is supported here Local Server geoprocessing tools support—ArcGIS Runtime SDK for Java | ArcGIS for Developers If you didn't want to follow the Local Server / Geoprocessing approach, it wouldn't be hard to to take the bounding box of your geometry and write some of your own code to create a fishnet. You could display this in a graphic layer. I'm not sure of your workflow or what you need the fishnet for, but do either of these ideas help?
... View more
10-14-2020
03:36 AM
|
1
|
1
|
1231
|
|
POST
|
This isn't something we've seen before and we've not had crash reports like this in any of the apps we deploy to the app store. There is however no escaping the error you are seeing in the log. Some more information would be helpful to track this down. Do you have any information of what the tests are doing at the time of the crash? Also some clues about your code would help. It's pretty obviously happening when you are calling a MapView.getRotation, but can you tell me a little more about the context you are calling this in? Also can you confirm what version of the API you are using?
... View more
10-13-2020
05:20 AM
|
0
|
0
|
1693
|
|
POST
|
Hi Rafael, For the bearing calculation there isn't a method which takes 2 points. I can however see the value in it so we may consider if for a future release. In the meantime my method should work, but the calculation will only be correct for project coordinate systems and over small distances to be accurate. Glad this helped. Mark
... View more
10-09-2020
08:36 AM
|
0
|
0
|
2028
|
|
POST
|
I'm looking at for format of you license code and I'm not sure these is complete I appreciate you've sensibly replaced numbers with "*", but is this all you were given? Can you tell me where you got the code from? Can you also confirm what version of the product you are using?
... View more
10-08-2020
01:07 AM
|
1
|
2
|
2347
|
|
POST
|
I'm happy to help but you'll need to give me some clues about what is happening and what your code looks like. Can you share any code and a stack trace? What device are you running on? Emulator or physical? What data are you using and what is your app doing? I also noticed an error in my original reply. I said that 100.8 was out latest release whereas its 100.9. However this shouldn't make any difference. There are lots of sample apps which you can try out which might show you how to get going here written in Kotlin and Java. This is a good starter app : arcgis-runtime-samples-android/kotlin/display-map at master · Esri/arcgis-runtime-samples-android · GitHub There is a Java equivalent there too: arcgis-runtime-samples-android/java/display-map at master · Esri/arcgis-runtime-samples-android · GitHub
... View more
10-08-2020
12:47 AM
|
1
|
0
|
1951
|
|
POST
|
I'm sure there are many ways of achieving this but I've found the following works. So lets start with a line and draw it. // create a purple (0xFF800080) simple line symbol
SimpleLineSymbol lineSymbol = new SimpleLineSymbol(SimpleLineSymbol.Style.DASH, 0xFF800080, 4);
// create a new point collection for polyline
PointCollection points = new PointCollection(SpatialReferences.getWebMercator());
// create and add points to the point collection
points.add(new Point(-302232.417504, 7570568.626755));
points.add(new Point(-294306.469759, 7574158.422559));
// create the polyline from the point collection
Polyline polyline = new Polyline(points);
// create the graphic with polyline and symbol
Graphic graphicLine = new Graphic(polyline, lineSymbol);
graphicsOverlay.getGraphics().add(graphicLine); Then we get the mid point in 2 steps. First, you find the length then draw a point along the line at a distance of half that length: // get start and end points
Point startPoint = polyline.getParts().get(0).getStartPoint();
Point endPoint = polyline.getParts().get(0).getEndPoint();
// get the length in metres
double length = GeometryEngine.distanceBetween(startPoint, endPoint);
// use the length to get the mid point
Point midPoint = GeometryEngine.createPointAlong(polyline, length/2);
// draw the mid point
SimpleMarkerSymbol sms = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFF00FF00,10);
Graphic intersectGraphic = new Graphic(midPoint, sms);
graphicsOverlay.getGraphics().add(intersectGraphic); Calculating the bearing can be done using basic geometry, but note this will only work with a projected coordinate system. // working out the bearing of the line.
double xDiff = endPoint.getX() - startPoint.getX();
double yDiff = endPoint.getY() - startPoint.getY();
// get the angle
double angleRad = Math.atan(xDiff/ yDiff);
double angleDeg = Math.toDegrees(angleRad);
System.out.println("angle " + angleDeg); Does this help?
... View more
10-06-2020
07:33 AM
|
1
|
2
|
2028
|
|
POST
|
That is very curious. I'd be interested to compare the Kotlin code which doesn't work with the Java code which does. If you want to share this code, I'd be happy to comment on why the Kotlin code didn't work.
... View more
10-05-2020
12:59 AM
|
0
|
0
|
3418
|
|
POST
|
Can you share any code or data which would reproduce this issue? I've been running the sample code this morning from this sample code and it is fluid and not flashing. Does this sample work for you without any issues?
... View more
10-02-2020
02:28 AM
|
0
|
2
|
3418
|
|
POST
|
The stack trace doesn't give me much to go on. Can you show any code and say what version of the API you are using? Not sure if you are using Kotlin or Java, but here are some samples which may help to explain how to perform geocoding operations. arcgis-runtime-samples-android/java/find-address at master · Esri/arcgis-runtime-samples-android · GitHub arcgis-runtime-samples-android/java/find-place at master · Esri/arcgis-runtime-samples-android · GitHub The above samples are Java, but we have the same ones written in Kotlin in the same git repository. Does this help?
... View more
10-01-2020
02:47 AM
|
0
|
2
|
1410
|
|
POST
|
The code in the example I have above explains how to move a graphic. You just need to create a new geometry and apply it to the existing graphic. // this code section is for moving the graphic to a new location
// start by creating a new point
Point newPoint = new Point(5000,5000);
// apply the new point to the graphic
graphic.setGeometry(newPoint); If this isn't what you are trying to achieve, then can you explain exactly what you are trying to implement.
... View more
09-29-2020
03:46 AM
|
0
|
0
|
1929
|
|
POST
|
The API has changed a little, but once you have understood the new concepts it will work well for you. In your application it sounds like you are maintaining your own locations which you display in your app. If this is the case then the container you will want to use is a GraphicsOverlay. I have shown some very simple code below which creates a graphics overlay, adds it to your MapView and adds a graphic. It then goes on to move the graphic straight away. Note that the Point class is immutable. // create a graphics overlay
GraphicsOverlay graphicsOverlay = new GraphicsOverlay();
mapView.getGraphicsOverlays().add(graphicsOverlay);
// make a symbol for your graphic - this is just a dot
SimpleMarkerSymbol simpleMarkerSymbol = new SimpleMarkerSymbol(SimpleMarkerSymbol.Style.CIRCLE, 0xFF00FF00, 10);
// make a point geometry - note its immutable.
Point initialPoint = new Point(1000,1000);
// create your graphic from the symbol and geometry
Graphic graphic = new Graphic(initialPoint, simpleMarkerSymbol);
// add it to the graphics overlay - this will allow you to see the point
graphicsOverlay.getGraphics().add(graphic);
// this code section is for moving the graphic to a new location
// start by creating a new point
Point newPoint = new Point(5000,5000);
// apply the new point to the graphic
graphic.setGeometry(newPoint);
// your graphic is now in the new location! There is lots of documentation explaining how this work here: Add graphics and text to graphics overlays—ArcGIS Runtime SDK for Android | ArcGIS for Developers There are also samples in gitHub. arcgis-runtime-samples-android/java at master · Esri/arcgis-runtime-samples-android · GitHub (Kotlin examples are there too if you prefer). There is an example of a 3D app which shows how to rapidly update graphics which you can take a look at: arcgis-runtime-samples-android/java/animate-3d-graphic at master · Esri/arcgis-runtime-samples-android · GitHub Does this help?
... View more
09-29-2020
01:45 AM
|
0
|
2
|
1929
|
|
POST
|
10.2.9 is a very old release which is no longer supported or in development. The current release of ArcGIS Runtime is 100.9. Have you tried your layer in this version? If you want to try it out, there is a github repository with lots of samples showing how to implement various use-cases. This sample may be of interest to you: arcgis-runtime-samples-android/kotlin/display-kml at master · Esri/arcgis-runtime-samples-android · GitHub
... View more
09-28-2020
12:51 AM
|
0
|
0
|
1332
|
| Title | Kudos | Posted |
|---|---|---|
| 1 | 05-12-2026 01:35 AM | |
| 2 | 05-07-2026 06:59 AM | |
| 1 | 08-13-2024 05:17 AM | |
| 1 | 07-10-2024 01:50 AM | |
| 1 | 04-22-2024 01:21 AM |
| Online Status |
Offline
|
| Date Last Visited |
05-13-2026
06:46 AM
|