Export Map Style from Google Maps Platform - google-maps

Google have decided to replace their Map Style tool with the Cloud-base Maps Styling.
The new Beta tool allows you to import JSON map styling, but it provides no way of exporting a map style created with the Beta tool.
A colleague of mine has created a custom Map Style, but now we need to copy it into another project, but there appears no way to do this. We can duplicate the style, but only into the same project.
Is there any way around this, eg. a GCP console command.
I've tried inspecting the network traffic to see if I can grab the config, but it's in a completely different format that can't be exported.
Edit: It may appear I've done no research on this question, but the fact is that because it's referring to a Beta GCP tool, there is very little information available on its use other than:
A blog post
A sidebar which concentrates on the publishing side
All the Maps API docs refer to using a Map ID, which isn't the problem here.
Another Edit:I've created an feature request, in case anyone is interested...

Related

Is it possible to avoid tolls in Google Maps URLs latest version?

In the old Maps URLs API, you could add "&dirflg=dt" in the URL.
Here's an example URL using the new API taken from Google's official pages here:
https://www.google.com/maps/dir/?api=1&origin=Google+Pyrmont+NSW&destination=QVB&destination_place_id=ChIJISz8NjyuEmsRFTQ9Iw7Ear8&travelmode=driving
In the Google official pages, I was unable to find anything related to sending it flags to avoid tolls so I'm not even sure if it is possible with the new API.
Does someone have any info to enlighten me with? Thanks for reading.
:)
This is not possible with the Maps URL in this version, but you can do this manually after loading the directions.
You can try this:
Load the URL. (eg.:
https://www.google.com/maps/dir/?api=1&origin=Google+Pyrmont+NSW&destination=QVB&destination_place_id=ChIJISz8NjyuEmsRFTQ9Iw7Ear8&travelmode=driving)
On the left part of the screen, click OPTIONS.
Under Avoid, check Tolls.
However, if you want this functionality to be in the parameters, you can send your ideas by going in the Maps URLs Documentation and click SEND FEEDBACK. Or you can submit this as a Feature Request in Google Issue Tracker
Hope this helps!
This is possible, but you have to use "undocumented" features.
Warning: Since these are not documented features, they probably aren't official and likely subject to change without notice. Use in production at your own risk.
tldr:
https://www.google.com/maps/dir/{origin}/{destination}/data=!4m3!4m2!2m1!2b1
Plug in origin and destination and it should load directions, avoiding toll roads.
Explanation:
Here, we are using Google's own data/options string (see: "data=") to get the desired functionality. It is meant to be used by the Google Map's web app itself to communicate options selected on the page. This article (and the ones following it) explain how to create your own "data=" strings to customize how the map is configured. It's quite comprehensive, but like I said above, its not an official feature.

Correctly importing Google Maps API into UI5 Application

I'm having trouble determining the best way to import a third party library such as the Google Maps JavaScript API into a UI5 application. I have considered the following methods so far:
Using a <script> tag in index.html, such as
<script src="https://maps.googleapis.com/maps/api/js?key=api_key"></script>
This works when testing locally but as mentioned in this SAP blog post, an app that is launched from the SAP Fiori Launchpad launches via the Component.js, not the index.html
That same blog post mentions importing a library via sap.ui.define, which is in fact what I'm doing with moment.js already in the application, which works. The problem is that the Google Maps API does not expose a global instance name / does not consist of a single JS file which can be imported, and thus this import fails. A similar question was asked in June last year but did not get answered.
A comment on that same question mentions using require.js to import the Google Maps API. This will likely work but seems like a hack. It feels like there should be some UI5-specific way to do this without having to import yet another third-party library.
Finally, this SAP blog post suggests manually creating and appending the Google Maps import <script> tag into the DOM once the window has loaded. This also seems like a hack but might be the only way to achieve this for the time being.
Any help determining the correct method of achieving this would be appreciated!
Well, I would do it like this:
Create custom control for map (better from sap.ui.core.HTML);
In init method of this control, load GoogleMaps by adding script tag to the page (no load event required here, because page is already loaded when this code executes);
In renderer of this new control, create a div where map will be rendered;
HTML Control has very important property - "preferDOM", this has to be set to true, otherwise, when UI5 rendering cycle happens, GoogleMap will be destroyed and created again which is very bad user experience in this case.
There are lots of different ways to implement google maps in UI5 apps:
If you are using SAPUI5: there are controls for generic map integration which you can configure to use google maps as provider:
https://sapui5.hana.ondemand.com/#/entity/sap.ui.vbm.GeoMap
https://sapui5.hana.ondemand.com/#/entity/sap.ui.vk.MapContainer
If you are using OpenUI5 you may be interested in this community library that wraps the google API in custom controls:
https://github.com/jasper07/openui5-googlemaps
If you are in need of something else, you can inject the JavaScript of google directly as the above poster explained and inject the map into the app but it might not be flexible enough. You can always create a simple custom control rendering an empty div for the map and connect it with the maps API to render the map via google API's.
However, pay attention to the Google TOS, they might require a license to use the maps API productively in your code.
Have Fun,
Michael
I ended up doing the following, which seems to provide the desired results:
jQuery.sap.includeScript(
"https://maps.googleapis.com/maps/api/js?key=api_key",
"includeGoogleMaps",
function () {
// Do things
}
);
I found this solution in the following Stack Overflow questions:
Using external js libraries in sapui5
UsingjQuery.sap.includeScript().then() in HCP Firori Launchpad
If there's anything wrong with the proposed solution, please let me know.

How to create a floormap using google maps api

Im working on a project to create a google map of an internal floorplan of my company's buildings. I dont want to use google's new indoor maps features as we dont want the floorplans available to the public. I was wanting to create an entirely custom map and just use the google maps engine and strip away the traditional world map tileset. Is this possible and how would I go about do it? Currently our floorplans are in an image file so a way to import those easily would be ideal.
I faced this problem creating an app last summer. It does not look like Google Maps (at least at that time) allowed for custom map tiles. I ended up implementing my own Map function, however I used XML files to create colored maps. The functionality would be the same if you wanted to use images, however.
The only drawback is that the features do not have such things that are built in with Google Maps, like dropped pins, etc. due to the fact that it is a custom built module. The repo is on GitHub here: https://github.com/krmannix/SmartMart
The Android Activity that holds the map is located within SmartMart/SmartMart/src/com/example/searchcell3/MapListActivity.java

how to access the google map API dynamically in j2me

I have to include the google map API in j2me application. I want to change the route and change the center position dynamically. I have searched a lot. Now I am using google static map API but it shows the image statically. I want to show the map dynamically.
Using javascript API v3 shall I implement google map API in j2me. But one of forums I have found we can't use javascript API in j2me application. Please Give clear idea about this why we can't implement in j2me.
I haven't taken a deeper look, but I found these two links when searching Google.
http://www.developer.nokia.com/Community/Wiki/Archived:Google_Static_Maps_API_in_Java_ME
http://www.jappit.com/blog/midmaps-google-maps-java-me-library/
Whereas it is technically possible to use a static mapping API to display an map in Java ME, If you want to dynamically update the map, you would be much better off using a library which uses a tile server, caches your map tiles and overlays objects on top of it.
This should result in a much lower data traffic overhead as explained here. Only use a Map Image API if all you need is a single map image.
The dynamic mapping library I would suggest is Nokia's HERE Maps API for Java ME, as you can tell from the name, the API is specifically designed to work with Java ME devices.
The API is currently bundled with the Nokia Asha SDK 1.0, but despite this, it is in reality a separate independent plugin and has been designed to work with the full range of standard Java ME devices.
A similar Stack Overflow question answered here describes how to download it.
As a notice of affiliation, I should mention in passing that I do work for Nokia.

Stored Map Like Google Maps or OpenLayers

Is Their anything like stored maps from where I can get Latitude/Longitude from address and vice versa. Like a database file or something else other than web based services so that I will not have to be connected over Internet while calculating address from Latitude/Longitude and Counter-wise.
Thank You
EDIT : Just to be clear. We use Google API's to find out Routes between two Geo-Locations I need the Same Feature.
Nominatim ? [1] It’s one of the source for the OSM home page.
Source code is on github [2].
1: http://wiki.openstreetmap.org/wiki/Nominatim
2: https://github.com/twain47/Nominatim
EDIT: I didn’t understand correctly. You can checkout OSRM : http://project-osrm.org/
Maybe you can check out Navit it is an open source offline routing and navigation application. They have a wiki over here which also explains a bit about routing.
I have not tried the application, but one of the features mentioned in the wiki is "adress and POI search".
There are several means of contact mentioned in their wiki as well, if you want to ask them about how they did.
You might also want to check out this list to find other interesting apps that provide offline map storage, routing and/or offline address search http://wiki.openstreetmap.org/wiki/Software/Desktop
This looks interesting as well: OSM Automated Navigation Directions.