Google Maps v3 APIs Geocoding and Places Inconsistent Viewport - javascript

I'm working on a Google Maps project where we want the customer to type in an Autocomplete address and then be taken to that place on the map.
My manager wants a consistent "viewport" result when compared to the viewport achieved when searching for the same place on maps.google.com.
I found an inconsistent result for a certain location, in particular for the Australian city of Sydney.
The result I get back from Places Autocomplete for Sydney looks quite zoomed in (I used the response's viewport data and call map.fitBounds(...). I'm a first time Stackoverflow user, so I can't post images yet - instead, the effect can be seen by entering 'Sydney, New South Wales, Australia' at the following page: https://developers.google.com/maps/documentation/javascript/examples/places-autocomplete
Alternatively, if I use the Geocoding API instead and take the viewport data response and use that to call map.fitBounds(...), I get a zoomed out view, similar to what I would see when I look for Sydney on maps.googles.com.
I would be very grateful for any suggestions that would provide a solution that gives my customers a viewing result that is 100% consistent with maps.google.com. For example, should I be using a different version of the Autocomplete API, or pass a special parameter? Ideally I would prefer to not be calling the Geocoding to retrieve and override the Autocomplete viewport response, since that would double up my API traffic and double the hit on Google's servers.
I look forward to any advice anybody can offer, thank you!!!

Are you wanting the map zoom level to be consistent after the search ?
I do android with google map. And just by looking at the code from the provided link above.
change that map.setZoom() method to the level you want might help.
I haven't done javascript google map api yet. Just taking a wide guess.
If I am answering the wrong question, please correct me.

Related

How can I display OSM maps in Flutter 'Web'?

I'm trying to create a custom map using Flutter Web that would be capable of displaying custom statistics for a place for COVID-19.
First we'll have a interface that display statistics for our entire planet:
https://google.com/covid19-map/?hl=en (Just like htisw)
Then the user can click on any country to zoom-in with probably an ease-in transition to see the number of cases in each state or province of that country. Assuming that I am able to fetch the exact co-ordinates of the epicenter in that country, I would like to deepen the shade in those parts in such a way that it lightens out as we move towards areas which have a lower number of cases.
Is it possible in Flutter Web?
I came across this plugin (thanks to this thread on SO Openstreetmap in Flutter?)
https://pub.dev/packages/flutter_map
but it doesn't explicitly say that it supports Flutter Web.
I tried fetching the tiles from OSM(Open Street Map) and displaying the maps on Flutter Web with the help of the example given in the above site https://pub.dev/packages/flutter_map#open-street-map-provider
But it didn't really display anything, maybe because a certain widget or function didn't work as expected.
According to your experience, which is the best way to achieve what I am looking for?
If possible, please describe the answer in such a way as if you were me and trying to do what I am doing.
Flutter_map doesn’t support flutter web.
You may check out the below Flutter Maps widget which has support for all the platforms including web.
https://pub.dev/packages/syncfusion_flutter_maps
Regarding the requirements you have mentioned, you can try the below things.
By dynamically changing the focal point and zoom level based on the click position, the easing effect can be achieved.
https://help.syncfusion.com/flutter/maps/zoom-pan#update-the-zoom-level-programmatically
With the combination of dynamically adding shape sublayers on top of the tile layer and color mapping for that shape sublayers, you may achieve this.
https://help.syncfusion.com/flutter/maps/shape-sublayer#shape-sublayer-on-tile-layer
https://help.syncfusion.com/flutter/maps/shape#range-color-mapping

Google / Bing Maps Show All Cities

Trying to find a way without zooming in real close to tell Google or Bing maps to show all cities. Bing does a good job for the most part but still when you zoom in it shows a whole different set of cities.
I have a large monitor this map is going to be sitting on and really need it to show more than just the cities it shows on for example zoom level 8 or 9 on Google. Right now I load in roughly 2900 different locations and mark them on the map so I am trying to do it via the API no just going to maps.google.com
Has anyone come up against this issue and found a fix? Did some searching here as well on Google and maybe looking it up wrong but haven't found anyone looking for something like this.
Hi you can do that by using the Image Map Type API by implementing the mapType interface. Please refer to this link and implement the code in the way given in the example, replacing details with your specifications.
Hope this will help!!
I couldnt find either enough information to get "mapType" to work how I was wanting or it just doesnt do it. The goal was to be at lets say a zoom level of 8 and see every city in the US. I couldnt get any of the suggestions to do that.
Here is what I found that allowed me to do it my self though:
http://google-maps-utility-library-v3.googlecode.com/
Basically I put in a transparent marker so it didnt show up then put info boxes with the names. This actually worked really well for me because I can zoom out 100% and still see all the names. Although at that level they would be overlapping being able to zoom in and out a few ticks and still see everything is great.

To show the route by clicking between two points on Google map in Blackberry

I am using JavaScript code to show the multiple pin points on Google Maps using Brownfield. I set the first clicked point as the center point, and when the user clicks on any other point (which is not the center point) I want to display a route mapped from the center point to that clicked point.
I would appreciate help of any sort, including ideas besides using JavaScript.
Google has a number of services available to people who program using their Maps. Go to https://developers.google.com/maps/documentation/javascript/reference and check out the directions services. I'm not very familiar with them, but I'm guessing it's similar to their other services. You make a directions request object supplied with point a and point b, and it will send a message to Google asking for the appropriate directions, which will be returned in some sort of result object that you can use to show the way. Update point b each time the user clicks and resend the google request, and it should update the path. Check out the API and it shouldn't be too hard to get it working. As for alternatives to javascript, Google Maps is written all in javascript, so there really is no other way. But I know from experience, most of their supplied code works really well, so I bet you can get it working!
Following link will show the route between two points:
J2ME/Android/BlackBerry - driving directions, route between two locations

Creating a small database of DC bikeshare locations

I'm kind of new to this site and programming in general, so please excuse me if I say something incorrectly.
I need to find a list of all the latitude-longitude locations of the bikeshare kiosks in DC. The map with all the stations can be found here. Basically I can't figure out how to do this without manually going in, finding where exactly the kiosk is on the map on the bikeshare website, and then locating it through google maps to find the lat/long (I found out that this can be done by right clicking on the location in google maps). I've searched long and hard to see if there is a database somewhere that has stored this information, or if I can get it from the bikeshare site directly, but I can't find it anywhere.
I can do it for the DC metro station by clicking on the map directly (like here, if you click on the map, you can see a google maps page pop up with the lat/long location).
This is my first time using the Google Maps API. I want to be able to get these locations because I want to depict it onto a custom map of my own using Javascript (which I have also never used before). Any kind of help would be extremely helpful!
Diving a bit into the source code you'll quickly find http://www.capitalbikeshare.com/js/maps.js, and there you can see that the positions are loaded from http://www.capitalbikeshare.com/stations/bikeStations.xml.
You also might have found that using the Network tracker in your browser's debugging console.
http://www.capitalbikeshare.com/stations/bikeStations.xml

Google Maps directions text format

Ive noticed that sometimes gmaps directions display a turn like this:
Turn right at Gallardo
and sometimes like this:
Take the 1st left onto Arregui
I need to always see the 1st,2nd,.. like in the second example. Is there a way to receive directions in this format always?. Thanks.
I seriously doubt it. There's no mention of being able to control anything except the language.
http://code.google.com/apis/maps/documentation/mapplets/reference.html#GDirectionsOptions
I do not believe so. It will give you 2nd left onto .... up to 3rd I believe after that it will just be the street name as per most directions you are given by maps / GPS systems and equipment. (The unwritten rules of the English road directions i guess)

Categories