Push pin on bing map - javascript

I am already done push pin on bing map but the issue is more than 100 push pin is not visible on bing map. I have REST api and I am getting data from api and fetch longitude and latitude on map. By the REST api push pin on map is working fine.
But more than 100 pins are not showing on map.
Is that any limitation for Bing map to allow less than push pins are showing ?

I'm assuming you're using the static map API although you didn't provide any sample code or explicitly list which API you were using.
If you check the documentation here under the "pushpin limits" section:
https://msdn.microsoft.com/en-us/library/ff701724.aspx?f=255&MSPPError=-2147217396
The static maps API only supports 18 pushpins if passed through the URL, or 100 pushpins if passed via POST. This is for performance and practical reasons - more than 100 pins on a small static map would just cover the whole image.
If you want to display more pushpins, you should use the interactive map control, not the static map API.
https://msdn.microsoft.com/en-us/library/mt712542.aspx

Related

Getting geolocation from IP address

I need to track user details, for that client's location and IP address is needed.
I got IP address from
$this->input->ip_address();
in codiigniter. Now the problem is how can i make their location in google map by using their respective IP address
just use ipinfo.io at
http://ipinfo.io/
it uses a location api that we can post ip address and it will returns the location details as json:
we can able to display the loacation on map with the langitude and longitude details from json response to google Maps API.
Here is the code i used:
this script creates a Google Map instance with lattitude & longitude from json response:
jQuery(document).ready(function(){
jQuery.get("http://ipinfo.io/202.88.237.138", function (response)
{
var lats = response.loc.split(',')[0];
var lngs = response.loc.split(',')[1];
map = new GMaps({
el: '#map',
lat: lats, //latitude
lng: lngs //longitude
});
}, "jsonp");
});
and the map will displayed on:
<div style="border:1px solid red; height:745px;" id="map"></div>
Google Maps API gmaps.js is needed to run this..
As a viable (although often less accurate) alternative, the HTML5 spec includes Geolocation. As HTML 5 becomes more and more prevalent I think we can expect to see this become standard in the future. It also does not require the use of external web services or libraries. Everything you need to geolocate is built right into the clients browser.
I believe the primary method used is IP address as specified.
The Google Maps API will do the work of finding location using geoip for you. If the user is on a mobile device or has a more accurate way of locating themselves (like a GPS), it'll use that instead.
Here's a good starting point:
https://google-developers.appspot.com/maps/documentation/javascript/examples/map-geolocation
If you absolutely need to fetch location from IP only, there are third-party tools that you can scrape to get this information. You should make sure you have permission beforehand if you're using this in a larger project.
freegeoip.net provides a public HTTP API to search the geolocation of IP addresses. It uses a database of IP addresses that are associated to cities along with other relevant information like time zone, latitude and longitude.
You're allowed up to 15,000 queries per hour.
If you need more than that, you can run the freegeoip as a web server on your own infrastructure. See: freegeoip on github

Routes marking in android Google Maps

How do I add a custom route in android using google maps. I am building an app similar to mapmyhike. Is it possible in Maps API V3?
Consider looking into this link
A DirectionsRoute contains a single result from the specified origin
and destination. This route may consist of one or more legs (of type
DirectionsLeg) depending on whether any waypoints were specified.
[EDIT]
Google Maps Directions API v3 for Android provide routes in the Encoded Polyline Algorithm Format.
So you can try something as follows:
android-draw-route-map-between-two-geopoints
You can pass latitude and longitude to this to get route directions for two points
String uri = "http://maps.google.com/maps?saddr="+ latitude + "," + longitude + "&daddr="+ latposition + ","+lngposition;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse(uri));
intent.setClassName("com.google.android.apps.maps", "com.google.android.maps.MapsActivity").addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT);
context.startActivity(intent);

Google map api get direction API instead of returning route , it returns nearby place like bus stop etc

We need to track user's path.
So for that we are using Google's map API --> input parameters are start location & End location to get route .
http://maps.google.com/maps/api/js?sensor=false
But in document of Google api
https://developers.google.com/maps/documentation/javascript/directions#DirectionsResults
As in document ---"end_location contains the LatLng of the destination of this leg. Because the DirectionsService calculates directions between locations by using the nearest transportation option (usually a road) at the start and end points, end_location may be different than the provided destination of this leg if, for example, a road is not near the destination."
In this API instead of returning route , it returns nearby place like bus stop etc.

Google Maps (javascript API): get GPS coordinates from address

I need to calculate the distance between two addresses and I don't need a map view or anything graphical.
I simply want the user to type in the address (end location is defined by myself) and let the javascript calculate the distance between the two points.
However I don't find a way to send an address string and get the GPS-coordinates from it using the Google Maps API.
(I really only need the two GPS points, the distance calculation is trivial.)
What you are trying to do is called geocoding. It is possible with the Maps API. See the Geocoding section for more details. This is the basic idea:
var geocoder = new google.maps.Geocoder();
geocoder.geocode({
"address": inputAddress
}, function(results) {
console.log(results[0].geometry.location); //LatLng
});
However, you are limited to 2500 geocoding requests a day, and what you are trying to do is against the terms of use:
Note: the Geocoding API may only be used in conjunction with a Google
map; geocoding results without displaying them on a map is prohibited.
This page describes a Google JSON service that you can extract gps coordinates from. I think this would also be under the "No Use of Content without a Google Map" in the TOS.
This is possible. See below link
http://briancray.com/posts/how-to-calculate-the-distance-between-two-addresses-with-javascript-and-google-maps-api

Destination value with DirectionsRenderer in Google Maps v3

Loving Google Maps API V3, but having difficulty in getting accurate driving directions and manipulating the destination address displayed when using DirectionsRenderer.
Regardless if I pass an address string or a latLng instance as the destination to DirectionsService, when I use the DirectionsRenderer to output step-by-step directions, the destination text is always the geocoded result of my original destination (i.e. the address, rather than COMPANY NAME).
Ideally, I want to pass a precise latLng destination to DirectionsService, but control the text displayed as the 'destination'.
I guess I could manually output the HTML, but part lazy, part not wanting to re-invent the wheel, would prefer to use DirectionsRenderer.
Any ideas?
You may use:
response.routes[0].legs[0].end_address="Company";
before calling
directionsDisplay.setDirections(response);

Categories