Overlapping markers when locations are close to each other Google Maps - google-maps-markers

I want to add markers to points close to each other on google maps, but the markers I add overlap even though the latitude and longitude information is different.
For example;
latitude: 38.1234 longitude: 27.123451
latitude: 38.1234 longitude: 27.123450
or
latitude: 38.12341 longitude: 27.1234
latitude: 38.12340 longitude: 27.1234
When I want to put a marker at these two points, the markers overlap.
How close can two points be to each other on Google maps?
Tester01:
Tester02:
View of Tester01 and Tester02 at Google maps:.

Related

How to Convert United States State Plane coordinates to Latitude and Longitude in Mathematica?

How to Convert United States State Plane coordinates to Latitude and Longitude in Mathematica?
I'm converting Washington DC Northing and Easting (in feet) of a location to latitude and longitude
Here is the address:
316 PENNSYLVANIA AVENUE SE 20003
And here are the coordinate:
X= 399901.19 Y= 135465.63
I know that I should be ND83 and my SPC Zone is MD-1900
I checked GeodesyData[] and I tried all these:
"NAD27", "NAD831986", "NAD83CORS93", "NAD83CORS94", "NAD83CORS96", \
"NAD83HARN"
with GeoPosition[{399901, 135465, 0}, datum] but with no success. I know in R I can use epsg:2804 or epsg:3559 but in Mathematica, I don't know which code to use, and none of these worked.
I found out how to answer it:
Our coordinates are in datum NAD83 for Maryland 1800. Therefore, our datum string for Mathematica should be "SPCS83MD00"
Knowing the State and the code connected to to the state are crucial to build the datum string. After SPCS83, one adds the state, in this case MD, and the last 2 digits of the four-digit code.
Hence, one can convert to (WGS84) or latitude and longitude as follows:
LatitudeLongitude[GeoGridPosition[{399901., 135466.}, "SPCS83MD00"]]
One more thing:
If you want to find out the extension for SPCS83 or NAD 83 in Mathematica you just need to use, and start typing SPCS83 or NAD83 and it will give you the possible string containing the state and its codes (some states have more than 1 code)
GeoProjectionData["SPCS83MD00"]

Handling large data set(100000) on Google Map using angular2

I am using google map in my angular2 app. I have also used MarkerCluster as below.
for (let marker of this._markers) {
let lat = +marker.latitude;
let long = +marker.longitude;
let markerobj = new google.maps.Marker({
position: new google.maps.LatLng(lat, long),
title: marker.name,
icon: {
path: google.maps.SymbolPath.CIRCLE,
scale: 6,
fillOpacity: 0.8,
fillColor: '#5A7793',
strokeColor: '#FFFFFF',
strokeWeight: 2,
},
map: this.map,
visible: true,
});
this.markerLayer.push(markerobj);
latlngbounds.extend(markerOnMap.getPosition());
markerList.push(markerOnMap);
}
let markerCluster = new MarkerClusterer(this.map, markerList, { imagePath: '../assets/images' });
I want to show around 100000 markers on google map. I am facing lot of performance issues when i tried to plot 100000 markers.
As per client requirement I can not use other map libraries. I need to stick with Google Map.
Do you have any suggestion which help me to improve the performance.
You don't plot 100,000 markers at once. What you need to do is reduce the amount of data you are displaying at a time. Only display individual markers when you are zoomed in so there are not so many markers in the view.
So what I would suggest is that load the markers from the server based on the bounds of your google map. So that would be the coordinates at the top left and bottom right.
So lets say you have 100,000 markers spread all over the world. At the world view it would be best not to show anything and ask the user to zoom in. Once you are at a lower zoom level use the bounds of the map to get markers from the server which lie inside those bounds. This should reduce the number of markers you have to display substantially. I don't know the coverage of your data but you can figure out what zoom levels work best for you.

How to get tweets for specific location(India)?

I'm trying to capture tweets using twitter4j's streaming methods from the area of India. I'm using below lat & long, but I am getting below exception.
Latitude/longitude are not valid: 8.07, 68.12, 37.10, 97.42
This is my code sample.
double[][] locations = { { 8.066667,68.116667 },
{ 37.100000, 97.416667 } };
FilterQuery query = new FilterQuery().locations(locations);
twitterStream.filter(query);
Please suggest me valid latitude, longitude pair.
Finally, I got correct latitude & longitude pair.
Twitter docs say that,
A comma-separated list of longitude,latitude pairs specifying a set of
bounding boxes to filter Tweets by. Only geolocated Tweets falling
within the requested bounding boxes will be included—unlike the Search
API, the user’s location field is not used to filter tweets. Each
bounding box should be specified as a pair of longitude and latitude
pairs, with the southwest corner of the bounding box coming first.
So, This is valid coordinates for India
double[][] locations = { {68.116667 ,8.066667, },
{ 97.416667,37.100000, } };

Balloon in amMap country map

I'm using amMap country map and want to show all country names in balloons without rollover or hover on that country. Means all balloons are visible on map load.
Showing more than one rollover balloon, or making it appear without hovering on a country is not possible, I'm afraid.
What you can do is to display a "label" on each of those countries. A label is an instance of MapImage with a text label and no actual image.
Placing an image/label for each country using longitude/latitude coordinate can be quite tedious work. Therefore you can use the following example which places area title in the geometrical center of each area automatically.
http://codepen.io/amcharts/pen/5687a78507081e1c8779cf067b762de7
The above map is for the United States, but you can use the code in it to process labels on just about any map.
The following code is responsible for that:
map.addListener("init", function () {
// set up a longitude exceptions for certain areas
var longitude = {
"US-CA": -130,
"US-FL": 120,
"US-TX": 1,
"US-LA": 40
};
var latitude = {
"US-AK": -85
};
setTimeout(function () {
// iterate through areas and put a label over center of each
map.dataProvider.images = [];
for( x in map.dataProvider.areas ) {
var area = map.dataProvider.areas[ x ];
area.groupId = area.id;
var image = new AmCharts.MapImage();
image.latitude = latitude[ area.id ] || map.getAreaCenterLatitude( area );
image.longitude = longitude[ area.id ] || map.getAreaCenterLongitude( area );
image.label = area.id.split('-').pop();
image.title = area.title;
image.linkToObject = area;
image.groupId = area.id;
map.dataProvider.images.push( image );
}
map.validateData();
console.log(map.dataProvider);
}, 100)
});
Please note, that sometimes country/state shapes will not make the dead center a perfect logical place to place a label. For those situations use the longitude and latitude overrides to adjust position of the label for the particular country.

Know nearest pin in a MapView from current location

I am using a MapView with some pins inside a city added. Also, the current user location is displayed in the map. With these two things known (user location and pins) I would like to show in a label the nearest pin from where the user is.
There is no direct API to find that. You have to loop through all annotations.
let pins = mapView.annotations as! [MKAnnotation]
let currentLocation = mapView.userLocation.location!
let nearestPin: MKAnnotation? = pins.reduce((CLLocationDistanceMax, nil)) { (nearest, pin) in
let coord = pin.coordinate
let loc = CLLocation(latitude: coord.latitude, longitude: coord.longitude)
let distance = currentLocation.distanceFromLocation(loc)
return distance < nearest.0 ? (distance, pin) : nearest
}.1
// Here, `nearestPin` is `nil` iff there is no annotations on the map.
If you don't know the reduce method, see the docs.
Use distanceFromLocation to calculate all the distance:
let distance = fromLocation.distanceFromLocation(toLocation)
you could calculate the distances for each pin in a for cycle, so to find the slower one
take a look at this:
Find nearest annotations from user location ios?
You might look at something like the Mapbox Distance API to do this in a single REST request: https://www.mapbox.com/blog/distance-api/

Resources