Moving marker GMap.Net - vb.net

MarkerA: Lat 21.192 , Lng 40.453
MarkerB: Lat 24.822 , Lng 46.718
MarkerC it's custom marker as a plane: Lat 21.192 , Lng 40.453
Using VB.NET AND GMap.NET, how can I make MarkerC moves toward MarkerB smoothly?
I need your help please to do that I'm done with Form load and can see all the markers on the Map, just need the animation step.

Related

Polyline drawn is showing below buildings

The polyline is drawn showing below building.
(source: gifyu.com)
How can I get the polyline top of all layers
please suggest
adding polyline as
var coordinates = locationsArrToAdd.map({ (location: CLLocation!) -> CLLocationCoordinate2D in
return location.coordinate
})
let polyline = MKPolyline(coordinates: &coordinates, count: locationsArrToAdd.count)
self.mapView.addOverlays([polyline], level: .aboveLabels)
According to Apple, the highest available level you can add an overlay to is the MKOverlayLevel.aboveOverlays constant you are currently using. However, their documentation states that this will:
Place the overlay above map labels, shields, or point-of-interest icons but below annotations and 3D projections of buildings.
From what I can see, the best solution is to disabled buildings in 3D mode, so that your polylines are visible:
self.mapView.showsBuildings = false

ArcGIS API: Drawing circle fixing center

I am using ArcGIS API v4.8 and the drawing tools to draw circle on my map.
1 issue I notice is when I draw a circle, the center of the circle moves when I move my mouse resizing the circle rather than fixed at the point of the 1st mouse click starts:
How do I fix the center regardless of how I move the radius of the circle? What is missing in my code?
const options = {view, layer: tempGraphicsLayer, pointSymbol, polylineSymbol, polygonSymbol}
let sketchViewModel = new SketchViewModel(options)
let drawCircleButton = document.getElementById('circleButton')
drawCircleButton.onclick = function () {
clear()
isDrawLine = false
sketchViewModel.create('polygon', {mode: 'click'})
sketchViewModel.create('circle')
}
EDIT:
I have found a similar sample, choose the Draw Circle tool, start drawing a circle on the map, you will notice that the center of the circle moves when you move your mouse, I want it to fix the center instead.
The problem when the center moves along with your mouse move is that the circle drawn is not accurate, as I want to start with the center of the circle I want, the circle can expand outward but the center should not move.
That is because the circle, in the given example, is being draw inside the square object. Basically your start and end point are representing corners, not the center point and outer layer of the circle. So every time you expand circle object, it expands from one corner, while the rest is dragging along your mouse.
Visual example:
There are workarounds for this of course. I've made a small sample code of one of the possible ways to draw a circle from a fixed center point.
https://jsfiddle.net/wLd46g8k/9/
Basically I used an ArcGis JS API 4.x constructor called Circle, where you pass a starting point and radius. In my example I've calculated the radius from these two points.
function drawCircle(){//draws the circle
graphicsLayer.graphics.removeAll();
var graphic = new Graphic({
geometry: new Circle({//circle constructor
center: startPoint,//pass the pointer-down event X Y as a starting point
radius: Math.floor(Math.sqrt(Math.pow(startPoint.x - endPoint.x, 2) + Math.pow(startPoint.y - endPoint.y, 2)))
}), //calculates endpoint distance from the startpoint and pass it as a radius
symbol: {//circle design
type: "simple-fill",
color: "orange",
style: "solid",
outline:{
color:"darkorange",
width:4
}
}
});
graphicsLayer.graphics.add(graphic);//adds the circle
};

Projection issue with ESRI JSAPI and ArcGIS map service

I was trying to obtain a gpx file with some coordinates by drawing on an Openlayers map with an ArcGIS baseMap.
When I draw the polyline and create the gpx, if I open it on Google Earth, what I see is not what I drawed before, the line is totally different from the original and not positioned where I drawed it.
I know it's a projection problem, I've tried trasforming the geometry object from Mercator to Geographic, also getting directly the geographic coordinates from the map coordinates, but nothing.
I tried to set "spatialReference" to 4362 and then to 3857, but nothing changes.
I'm going to use that .gpx on a gps device (the next week I'll go to the Svalbard islands and I need some gps tracks to go around Longyearbyen by snowmobile, there there aren't any sign of life out the town, so I must be prepared to it), when I'll be there I'll adjust the output right for the device they will rent to me, but now I need to save on the .gpx file almost the right coordinates.
I'm getting from the map those coordinates:
lat: 61.22582068741976
lon: 4.684820015391338
when I'm expecting instead something around 78. lat and 15. lon.
This is some of the code I use to create the map (I'm not pasting the code I know it's not responsible of my problems):
var initialExtent = new esri.geometry.Extent({"xmin":505615.5801124362,"ymin":8678955.717187276,"xmax":525935.6207525175,"ymax":8689168.654279819,"spatialReference":{"wkid":32633,"latestWkid":32633}});
map = map = new esri.Map("map", {extent: initialExtent, logo : false});
basemapURL = "http://geodata.npolar.no/ArcGIS/rest/services/inspire1/NP_TopoSvalbard_U33_CHL/MapServer/";
map.addLayer(new esri.layers.ArcGISTiledMapServiceLayer(basemapURL));
Here I'm using wkid 32633 that is the default for that map, tried to change with known ones, but nothing happened.
And now the code I use to get the coordinates:
dojo.connect(tb, "onDrawEnd", getCoords);
function getCoords(geo) {
var r=confirm("Salvare tracciato?");
if (r==true) {
geo = esri.geometry.webMercatorToGeographic(geo);
for ( var path = 0; path < geo.paths.length; path ++ ) {
for ( var pt = 0; pt < geo.paths[path].length; pt++ ) {
tra += '<wpt lat="'+geo.paths[path][pt][1]+'" lon="'+geo.paths[path][pt][0]+'"></wpt>';
}
}
}
}
"tra" is a variable that stores all the code I'll insert into the gpx file with an other function.
The "webMercatorToGeographic" function transform the map coordinates to geographic ones.
Thanks to Devdatta Tengshe on GIS.stackexchange I got what I need:
Use the proj4js library in your application. To do this, follow these
steps:
Download the latest library from
https://github.com/proj4js/proj4js/releases In your HTML file use
You'll
need to define the projections before you can use it. You can do this
by using the following lines of code: var UTM33N= "+proj=utm +zone=33
+ellps=WGS84 +datum=WGS84 +units=m +no_defs"; var GCS84="+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs";
When you need to transform, you can use the following line: var
transformed=proj4(UTM33N,GCS84,[x,y]); where x & y are the coordinates
in your given projection. As output you'll get an array with two
elements, the longitude, & the Latitude
That worked fine.

THREE.js rotating camera around an object using orbit path

I am struggling in solving this problem.
On my scene, I have a camera which looks at the center of mass of an object. I have a some buttons that enable to set camera position on particular view (front view, back view,...) along a invisible sphere that surroung the object (constant radius).
When I click on the button, i would like the camera to move from its start position to the end position along the sphere surface. When camera moves I would like it to keep fixing center of mass of the object.
Has anyone have a clue on how to achieve this?
Thanks for help!
If you are happy/prefer to use basic trigonometry then in your initialisation section you could do this:
var cameraAngle = 0;
var orbitRange = 100;
var orbitSpeed = 2 * Math.PI/180;
var desiredAngle = 90 * Math.PI/180;
...
camera.position.set(orbitRange,0,0);
camera.lookAt(myObject.position);
Then in your render/animate section you could do this:
if (cameraAngle == desiredAngle) { orbitSpeed = 0; }
else {
cameraAngle += orbitSpeed;
camera.position.x = Math.cos(cameraAngle) * orbitRange;
camera.position.y = Math.sin(cameraAngle) * orbitRange;
}
Of course, your buttons would modify what the desiredAngle was (0°, 90°, 180° or 270° presumably), you need to rotate around the correct plane (I am rotating around the XY plane above), and you can play with the orbitRange and orbitSpeed until you hare happy.
You can also modify orbitSpeed as it moves along the orbit path, speeding up and slowing down at various cameraAngles for a smoother ride. This process is called 'tweening' and you could search on 'tween' or 'tweening' if you want to know more. I think Three.js has tweening support but have never looked into it.
Oh, also remember to set your camera's far property to be greater than orbitRadius or you will only see the front half of your object and, depending on what it is, that might look weird.

Titanium Mapview Click Get the Lat and Long

I am looking to create a simple mapview in Titanium (appcelerator), but what I want/need to do is have the user click, or longpress on the the map and get the latitude and longitude from that selection on the map. The mapview does have a mapview.addEventListener('click',function(evt)), but I dont get a these values when clicked. Any help with this would be awesome!
It is very easy to just calculate the latitude and longitude from the click or longpress coordinates (if were not too zoomed out). Use this function inside the event listener taken from this question at Appcelerator Q&A:
var calculateLatLngfromPixels = function(mapview, xPixels, yPixels) {
var region = mapview.actualRegion || mapview.region;
var widthInPixels = mapview.rect.width;
var heightInPixels = mapview.rect.height;
// should invert because of the pixel reference frame
heightDegPerPixel = -region.latitudeDelta / heightInPixels;
widthDegPerPixel = region.longitudeDelta / widthInPixels;
return {
lat : (yPixels - heightInPixels / 2) * heightDegPerPixel + region.latitude,
lon : (xPixels - widthInPixels / 2) * widthDegPerPixel + region.longitude
};
}
Note that you cant listen for a longpress event on the MapView itself so nest it in a regular container view and add the listeners to that. Example usage like this:
var container = Ti.UI.createView({
top : 0,
left : 0
});
container.add(mapview);
container.addEventListener('longpress', function(e) {
var coordinate = calculateLatLngfromPixels(mapview, e.x, e.y);
var longitude = coordinate.lat;
var latitude = coordinate.lat;
});
This will work if your looking at a (relatively) small area of the earth, when youre fully zoomed out, you would have to use a mercator projection to get real coordinates because of the curvature of the earth, if you want to be fully zoomed out then use the module.
There is a module in the marketplace for that. It costs $0.99 to purchase and will give you the coordinates of a map https://marketplace.appcelerator.com/apps/1334