Skip to main content

Geocoding - Region biasing

    Today we will have a look at a simple geocoding example wherein we will see the effects of region biasing on geocoding. First things first. What is region biasing in geocoding and why is it required; would be an obvious looking question here. The answer to this is pretty simple and straight. Region biasing means returning a geocoded address so that it falls in the region specified. Consider the example of the city named “Hyderabad” which is  present in India as well as Pakistan. Now, suppose that my target users are from India, then by using the region biasing property, the geocoder will always return the “Hyderabad” in India when a user enters a request for the same. I have taken the same example in the code, so that the region biasing geocoding concept would become much more clear.

    The code goes here…


    The code is pretty simple and does not need an explanation. The crux of the code lies in the following line of code.


    As you can see, the region property is set to “IN” which is a code for India. This is a hardcoded example, where the address to be geocoded is set to “Hyderabad”. Check out the line, var query = "Hyderabad". Now as the region is set to India the output that would be seen will be as seen in the result section above.

    Now change the region value to “PK”, i.e. Pakistan as,


    The output that you will see is as below:



    If you have any queries regarding the code feel free to leave a comment! Till the next Google Maps API v3 example…Keep mapping!

Comments

  1. I tried region=IN but still getting suggestions for outside india.
    I am using auto complete to show suggestion like google maps do

    ReplyDelete
    Replies
    1. Hi IndiaVote09.

      Could you let me know what were you looking for (geocoding) with region=IN?

      Please respond and I would be happy to check and revert!

      Regards,
      Shreerang.
      Like us on Facebook at https://www.facebook.com/pages/Spatial-Unlimited/185149371538692

      Delete

Post a Comment

Please leave your comments here...

Recommended for You

Geodesic Polyline

    Today we will have a look at a very interesting polyline example - "The geodesic polyline". Now the first question that will pop is "What is geodesic?". Mathematically, geodesic means the shortest line between two points on a mathematically defined surface, as a straight line on a plain or an arc of a great circle or sphere.     The next question after reading the above definition is clearly, "Why do we need geodesic polylines?" and that would be followed up with "What is this Great Circle?". We will discuss this first, before we move on to the actual example today. The example is very very similar to the normal polyline example, with just a small change.     Having said so, I will now try to explain why we need a geodesic polyline? The shortest distance between two locations on the earth is rarely a straight line as the earth is roughly spherical in nature. So any two points on the earth, even if they are very close lie on a curve and n

Playing with the markers and info window bubbles...

    In the last few posts, we have seen some marker examples and some information window examples. Now, lets do something interesting combining these two things. Just writing that "This is an info window" in the information bubble is not very interesting! And I know this...Have gone through the same phase!     So, today we will do something interesting! We will display the latitude- longitude co-ordinates of the point that the user clicks on the map! Doing this is not at all complex! Copy paste the following code and you will see for yourself a map coming to life!     The output of the above code looks as seen in the result section above! If you have any queries regarding the above code please comment on the blog post or feel free to contact me at my mail ID .

Where does Google get it's live traffic data from?

Referring to a post that I wrote earlier, Google’s - Live traffic Layer , ever wondered how Google collected this data? I was wondering the other day, how Google received live data to display it on their maps as a layer! I looked up the web and found something very interesting and am sharing the same with you all. As we all know, the traffic layer is available most accurately in several states in USA. Most major metro areas in the US have sensors embedded in their highways. These sensors track real time traffic data. Easy to miss at high speeds (hopefully anyway, traffic permitting), more commonly noticed may be the similar sensors that often exist at many busy intersections that help the traffic lights most efficiently let the most amount of people through. The information from these tracking sensors is reported back to the Department of Transportation (DOT). The DOT uses this data to update some of the digital signs that report traffic conditions in many metro areas. They als

Retriving co-ordinates...

         We have seen 2 Google Maps API v3 examples wherein we have retrieved the latitude-longitude co-ordinates of the point of click on the map. In the first example we have displayed the co-ordinates in the information window and in the second , we have displayed the co-ordinates in a form in the information window.         Today we will create a code to retrieve the latitude longitude co-ordinates in a text box while simultaneously a marker appears on the map as well. So, here goes the code. <html> <head> <title> Google Maps API v3 - Adding marker on Click and retrieving the co-ordinates in a text box </title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map;    //When using event as a parameter to a function declare map, strictly as a global variable function initialize() {     var myLatlng = new google.maps.L

Form info window

         Today we will look at a Google Maps API v3 example to add a form in the information bubble! This is usually required when we wish to accept some data/information from the user! This data can be saved to a server in the form of an XML file or a database! The information can then be retrieved back at a later stage, when necessary!          In this example we will only look at form in the information bubble! The connectivity part with the server will be discussed in another post! So, today's code snippet is as seen below! <html> <head> <title> Google Maps API v3 - Adding marker and info window on Click and creating a form in the infowindow with the lat-lng information in it. </title> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script> <script type="text/javascript"> var map;    //When using event as a parameter to a function declare map, strictly as a