How to migrate code from Google Maps API V2 to V3? - google-maps

As the Google Maps JavaScript API Version 2 has been officially deprecated as of May 19, 2010. The V2 API will stop to work after May 19, 2013.
Does all the applications which we have develop using V2 going to stop after May19, 2013 and we have to migrate these to V3 before this?

I don't know if google has expressly said that they will remove the API and assets from being able to be used, but I do know that after May 19, all bets are off, they are free to take down the API and any/all assets that are required to support v2 at any time without notice, so it's kind of an "at own risk" deal.
It's time for you to migrate over....v2 has been deprecated for years and v3 is very well supported.
It's not ridiculously hard to migrate over, you can probably keep the majority of your existing codebase and just call a few different functions.
For instance, all of the original functions that you used to call like this:
new GMap2()...
new GMarker()...
new GLatLng()...
Have all been namespaced, so their equivalents in v3 would be:
new google.maps.Map()...
new google.maps.Marker()...
new google.maps.LatLng()...
Any time you'd be using services, however, like StreetView or DirectionsRenderer, you'd need to check the docs on that because those have changed slightly.
You'll have to chase some bugs down as you go through, but the docs are very very well organized and you shouldn't have that much trouble.
Best of luck!

Here's an easy guide on how to do the upgrade: http://gabrielduque.wordpress.com/2011/01/13/upgrading-from-google-maps-api-v2-to-v3/

Related

Upgrade to Google Maps version 3, or go to OpenLayers?

I manage the development of some academic web mapping software for authoring collections of geographic data. It's a fairly simple interface for creating historic maps. The project is based on Google Maps v.2, and because v.2 is going to be discontinued in 2013, we thought we'd bite the bullet early and upgrade to v.3.
It turns out that's a big job that requires completely rethinking how the map part of our application works. We have to rewrite all our custom Gmap controls, restructure several parts of the application, and a few other big changes--for example, v.3 doesn't integrate with Google Earth as well as v.2, and we use Google Earth a lot. Because of this, and because we're starting to use more features that Gmap doesn't support natively (like WMS maps), I've been wondering if it might be worth switching from Gmap to OpenLayers. From what I understand, OpenLayers has all the features of Google Maps, has native support for WMS and supports many more data formats, lets us use all the Google imagery anyway, and works with KML.
My question to the community is for people who know OpenLayers and Google Maps: can you give me an idea of how the workload for upgrading from Gmap v.2 to v.3 compares to a complete port from Gmap v.2 to OpenLayers? And what other downsides should we be aware of?
One of our biggest concerns: we use Google Earth a lot. If we went to OpenLayers, we'd have to synchronize Earth and OpenLayers ourselves, but it sounds like that's what we'd have to do in Gmap v.3 as well. From what I've read, OpenLayers doesn't have native support for Google Earth or any kind of 3D geobrowser, but there are some projects (like this) that try to bridge the gap. How much of a headache would this be?
Very interesting question!
Upgrade to newer version of Google Maps should be less time consuming because you already have working code and even though you make will have to make big changes you should be able to reuse some parts of the codebase. That's only my guess, because it's hard to be more precise without seeing the code :)
You should still take a look at OpenLayers. You mentioned that you already need WMS support and probably there are more features out there that OpenLayers supports and Google Maps doesn't. OpenLayers supports a wide variety of datasources, is open and follows OGC standards. It has support for Google Maps, and if you one day decide to change to Bing, Yahoo or your own maps you will only need to make minor changes to your code.
I was in the same situation. I took a look at openlayers and started implementing some of the functionality in openlayers. I was able to replace SOOOOO much google maps api code with just a few lines in openlayers. So i kept going, in no time i had re-developed in openlayers and cut down the javascript required to do so by more than half! I am also able to do much more! exporting, importing from all sorts of formats is now just lines of code rather than man lines. OpenLayers all the way!

Google Map version2 vs Version3. shall we continue with gmap version 2

My map project needed an update this month and when i referred gmap i saw the notification requesting to migrate to version3. This is from may 19th 2010.
There are three projects live which used gmap extensively.
Those projects are for Transportation department in which we have plotted a route for a bus service with many options.
What will be the problem if i let the existing projects be as they were. that is in version 2.
I would like to have suggestions for the above.
From the Google Deprecation Policy:
"For a period of 3 years after an announcement (the “Deprecation Period”), Google will use commercially reasonable efforts to continue to operate the Deprecated Version of the Service and to respond to problems with the Deprecated Version of the Service deemed by Google in its discretion to be critical. During the Deprecation Period, no new features will be added to the Deprecated Version of the Service."
http://code.google.com/apis/maps/terms.html#section_4_4
So you are probably good to keep using it for awhile - but eventually you will need to update.
Note that V3 is not guaranteed to be compliant with IE6, which is the reason why I am temporarily holding off on updating my own applications.
If v3 has all the features you need, then go with v3.

developing location/map based web site

I wanna start developing a map-based web site.
At first I ordered a regulat Gps device just to test the site, later on I would like to use Iphone's gps and other cell devices.
So I need something pretty generic.
I searched the web for map-based development framework and come up with too many of them :
Geo server, Map server, Open layers, Geoext , Google maps's api , and more.
I'm not a seasoned web developr (more of a c++ kind of guy) so I need something pretty straightforward , though robust at the same time.
Moreover, I need one which is free, and won't have licensing problem down the road.
At first I just need basic capabilities as displaying the gps data on my web site in real-time.
Can someone experienced recommend one ?
Thanks
Client
I'd go with OpenLayers - this is an opensource JavaScript client library, similar to the Google Maps API, or Bing API. However OpenLayers will free you of any licensing worries, or changing APIs as the source is available and can be modified - this is not the case with the Google/Bing/Yahoo APIs. You can however use the data from these services as layers in OpenLayers and drop them if they suddenly become filled with adverts or have commercial restrictions.
Have a look at examples to see if there is one you can use to make your first test application - http://openlayers.org/dev/examples/
GeoExtJS is a collection of extra tools and widgets that work with OpenLayers, built on top of another JavaScript framework ExtJS - also open source. ExtJS is mainly used for building user interfaces - data entry forms, grids etc. using JavaScript, to display in the browser.
If you are looking for tree structures to switch layers on and off and other more advanced UI widgets then GeoExtJS is worth looking into.
Server
If you are only displaying points then you can create dynamic KML or GeoJSON on your web server and reference this in OpenLayers. There are libraries in all languages that you can build on. Python has become a key languages in geospatial technologies, and has GeoJSON libraries you could script with.
GeoServer and MapServer are both server-side programs that allow you to serve out spatial data from databases with symbology, labelling etc. If you are having lots of different datasets then its worth spending time setting this up.
MapServer is written in C++ so it is probably easier for you to try this - however you may be able to get away without needing any specialist server side software, especially if your data consists of X,Y / Lon,Lat values that can be easily plotted as points.
For the beginning (you said that you need to show gps position in a real time) I think that Google Maps are good option here. This solution has very simple API and community support is also an advantage here (I've never compared with something else but I have good experince with GMaps and its tutorials/resources). This is for the client side, for server side any web framework should do the work (I use Django and it also have dupport for some geo things - mentioned later in this answer).
You need probably to build application that follows this rules:
Your GPS device sends data to your server(web application) periodically, data is stored in a db.
Users use browser to display data with map (eg. Google Map) which updates position periodicaly on some scheduled interval (eg. ajax calls to the server for the most current position). Each time response is recieved map need to be updated.
I don't know if there are more specialized solutions for this case.
If you need to improve your application and add some features you need to consider some more sophisticated geo frameworks. I have heard some positive opinions on GeoDjango, mainly because it can be easily incorporated with Django(which is very easy web framework to learn and it has a lot of capabilities).
All technologies I mentioned here are free.
I can recommend using the Google Maps API to render your maps in a browser. You can find my reasons in this answer.
The current version of the API has support for getting geo-location information for mobile devices.
I use Bing Maps for mobile. Mainly because its fast, and provides much better looking maps, 3d models, and satellite views for the UK than Google maps does.
I have also had issues with Google changing their service to provide some enhancements and it breaking my app, where at least with the Bing API theres a bit more compatability considered for existing apps. Not that I dont like the Google maps, I do. Its a backup service for me..
I generate maps from both providers, Bing as the primary, Goole secondary... this means that if ones offline of not working, which happens, my users still get to use my app.
Heres a link to Bing Maps Dev on a WIndows Phone for example
I'd take a look at Cloudmade. They have a number of API's, free options, paid options and use OpenStreetMap which for many places is one of the most accurate mapping solutions out there.
free , open source:
www.openstreetmap.org,
u can build ur own server as well using the same technolgogy:
http://weait.com/content/build-your-own-openstreetmap-server
API: http://wiki.openstreetmap.org/wiki/OpenLayers
Although its still in draft form, HTML5 will be supporting Geolocation API. Most major browsers and hand held devices should be supporting it in the near future and should make life a lot easier for developers who want a service independent solution. You would however still need a mapping service like google maps if you need to display locations.
function showMap(position) {
// Show a map centered at (position.coords.latitude, position.coords.longitude)
}
// One-shot position request.
navigator.geolocation.getCurrentPosition(showMap);
EDIT:
Its already supported in several major browsers:
Mozilla Firefox: supported in Firefox
3.5 and later versions.
Chrome: Supports thru Google Gears
Geolocation API
Opera: Supported in
nightly builds
Safari: Support is
coming soon in the IPhone’s Safari
browser.
Internet Explorer:
experimental support available from
IE8.

The state of GMaps v3

I'm about to start a Google map based project and am wondering if the release version of GMaps v3 has most of the features that are available in v2, or if it would be best to stick with v2 for now.
Is there anywhere that has a list of features in v2 that are not built into v3 yet - and features of v3 that are not in v2.
Personally, I'd avoid using v3 for live sites until it comes out of Google Labs unless you gain a significant advantage from the v3 features.
APIs in Code Labs may change at any time as they evolve. They are also not committed to the 3 year deprecation policy, and Google's obligations with regards to testing and bug fixing are more lightweight.
That's not just theoretical. The change of the get_ and set_ syntax only ran in parallel for a few weeks. Because v2 is a mature product, syntax changes that break large numbers of existing pages are avoided. If you do go with v3 you have to remain attentive to the possibility of future page-breaking syntax changes.
V3 releases end up having to be pulled back significantly more often than v2, that could be partly due to lightweight testing, but also because there's no equivalent of a v2.x release. v3 code goes directly from "Google internal testing" to "live on all v3 sites" in one step.
I'm using v3 for hobby, I've made a small project which allows you to add markers, measure distances, add polys, save maps and realod... I've found that v3 is faster than v2 with many markers (less than 100, without any clustering), and I've found simpler to add markers and customizing the icons. But, often, the guys in google changes the rules... so if you're starting a real job, I suggest to use v2, or you will have to always check if everything works.

Google Map API vs MS virtual Earth API

I thought of using map in my blog. So which api will suit for me??
I am expecting that map should have more features. I dont know how to use it.. Sorry if my question is silly.
I need docs of both. Please let me know??
Both mapping API's are well documented by the respective parties, just google it and you'll find what you need. The MS Api is a little more restrictive but then the MS maps have better support for bringing up nice looking pop-up boxes etc.
The only real considerations after working with both are design and whether you need https support or not because Google maps will give IE users on https a nasty security dialogue pop-up that won't go away unless you pay Google $10,000 (but being for your blog I wouldn't imagine your fussed about that)
They are both pretty similar. I have used Google Maps API and it is very easy to get up and running and does everything I need. It also has street view which is a nice extra.
You should provide us more details in order to get a better answer but I will give you my thoughts anyway:
I have used the virtual earth API in a project I did in 2007. By that time we decided to go for the MS version as it had a better documentation and would fit better with our technology set i.e. MS SQL, .NET etc .... and best of all: it was for free!
Google at that time was offering a nicer UI for maps and stuff but after a certain number of requests you would start getting charged....
If you are developing in .NET I would certainly go for Virtual Earth now as Microsoft has shipped the official virtual earth sever side control ....
Some links:
http://dev.live.com/Virtualearth/sdk/
http://code.google.com/apis/maps/
Personally I think Virtual Earth is an inferior product compared to Google Maps with Street View. I haven't looked at either API but my experience with using other web based APIs from Google and Microsoft is that Google exposes a lot more functionality. The web is their bread and butter. It's a defensive action from MS. I love MS btw, so this isn't a hater ranting...
Pretty sure that MS Virtual Earth will require your users to download a viewer specific to actually see and interact with the map. The Google API will work directly with the browser. Really it comes down to what sort of functionality are you looking to include? if you just want to display various places on a map then GoogleAPI will work fine for you, if you want to be able to do an exploded view of a location from 3 miles away and then zoom in on it like you would if you approached it in a fast moving plane then MS Earth.
Google Maps API or MS Earth Developers