I'm using Google Maps SDK for my Xamarin.iOS app and i got an problem.
I want to put MapView into specific UIView(that was created on Storyboard) and that is no so easy as expected.
At current moment i have tried to put MapView class into my UIView class(in native iOS Development its an solution),but it didn't worked.
Also i have tried to do something like this:
//init google SDK stuff
MyViewWhereIWantToPutGoogleMaps.AddSubview(MapView); // and the same,no effect
Any ideas? Thanks.
Remember you need to indicate the CGRect for the MapView object.
If you want it to cover the whole space in MyViewWhereIWantToPutGoogleMaps you just do:
var frame = MyViewWhereIWantToPutGoogleMaps.Frame;
var googleMaps = new Google.Maps.MapView (new CoreGraphics.CGRect(0, 0, frame.Width, frame.Height));
MyViewWhereIWantToPutGoogleMaps.AddSubview (googleMaps);
Hope this helps.-
Related
I'm using Google Maps SDK to show a map on my site. In addition, I'm showing some custom pins using tiles overlays -> https://developers.google.com/maps/documentation/android-sdk/tileoverlay .
I'm inserting an overlay like this:
const tileAdaptor = new SomeAdaptor();
map.overlayMapTypes.insertAt(0, tileAdaptor);
And now, from other part of my code, I want to access that same instance. I was doing it like this:
window.map.overlayMapTypes.je[0];
But, surprisingly, the .je attribute has been renamed! I do not know if that's because it's an internal API or something like that. Now it has been renamed to .td.
So, my question is, is there a way to get that first overlay without using internal APIs?
Don't use undocumented properties, they can (and will) change with any new release of the API.
You need the overlayMapTypes property, which is a MVCArray, which has a getArray method
window.map.overlayMapTypes.getArray[0]
Is there any way how make normal Map View in flutter. I need to have map ready when user opens the app. Only thing I saw, is that apptree plugin, but I could only make the map appear after user taps the button (and fullscreen, I need to put it into container). Basicaly what I need is some Map Widget, is there any ?
You can use some plugin like
https://github.com/apptreesoftware/flutter_google_map_view
flutter plugin for displaying google maps on iOS and Android
//Create an instance variable for the mapView
var _mapView = new MapView();
//Add a method to call to show the map.
void showMap() {
_mapView.show(new MapOptions(showUserLocation: true));
}
Unfortunately this is one of the drawbacks of choosing to render own components on GPU instead of using OEM solutions, they need to bake GMaps renderer over Flutter APIs and probably will, in the meanwhile, try this implementation: https://github.com/apptreesoftware/flutter_map
I am making application on Titanium for iOS and android.
This application uses Ti.Map.
I would like to add image on Ti.Map (google map or apple map)
I have confirmed googlemap API has this function like this below.
Adding a Custom Overlay
I have checked methods of Ti.Map and found createCircle or createPolygon....However these methods are not what I want.
Can I add image as overlay on Ti.Map of Titanium????
No. Ti.Map is very basic and only provides for polylines, polygon and marker additions, but not customizing of the view. If it were possible, it would be only on Android because that is Google Maps.
For your cause, I suggest you add a webview to your app, and use the JavaScript API of Google Maps to fix this. And within this webview add a full size Google Map, so you will not see any borders whatsoever. Should work perfectly fine!
I need to implement directions using Google maps inside my GWT web application.
Currently I'm using maps API v2 library.
I have several issues I have not been able to solve yet:
Include Get Directions panel (similar to the Google maps one)
Get list of streets names from the request.
PS How to implement mouse wheel zoom control?
Here is the answer for your mouse wheel zoom question
Implement HasMouleWheelHandlers and its the API's like getX(), getY(), getScreenX(), getScreenY() and do your zoom operations
I found out how to easily implement zoom functionality:
final MapWidget map = new MapWidget(startLatLng, 12);
map.setSize("100%", "100%");
MapUIOptions options = map.getDefaultUI();
options.setScrollwheel(true);
map.setUI(options);
For more info check out maps demo. You can checkout project code and test it in eclipse!
I'm still searching for solution to other problems.
I have a batch of high definition images, and I want to make use of technologies like google maps to view the images, user can use zoom pan to zoom in and out quickly without downloading the whole big picture file(they only need to download the viewport of the big image).
How can I do this?
Thanks.
Bin
If the image in question is actually a map or something that can be reasonably overlaid onto a map, use MapTiler (http://www.maptiler.org/) to split it into tiles, then use code like this to display the tiles:
var lat=37.767569;
var lon=-122.392223;
var initialZoom=17;
var tileDir = 'tiles_dir';
var mapTypeId = 'Your Custom Map';
var mapType = new google.maps.ImageMapType({
tileSize: new google.maps.Size(256,256),
getTileUrl: function(coord,zoom) {
return "img/"+tileDir+"/"+zoom+"/"+coord.x+"/"+coord.y+".png";
}
});
var map = new google.maps.Map(document.getElementById("map_canvas"),
{center:new google.maps.LatLng(lat,lon),
mapTypeId:google.maps.MapTypeId.ROADMAP,
zoom:initialZoom,
mapTypeControl:false});
map.overlayMapTypes.insertAt(0, mapType);
map.mapTypes.set(mapTypeId, styledMap);
map.setMapTypeId(mapTypeId);
Note that Map Tiler sets the image name to something Google Maps API v2 specific. If you are using v3 (and you should!) you'll have to take each file name (e.g., 2001.png), and move it to a file name that's good for v3. To do that on Linux or a Mac, cd to the tiles directory and run this script (note that the script assumes you are in the tiles dir!):
#!/bin/bash
tiles=`ls -d */*/*`
for thisPath in $tiles
do
thisFile=${thisPath#*/*/}
oldY=${thisFile%.png}
zoomX=${thisPath%/*}
zoom=${thisPath%/*/*}
newY=$(((1<<zoom) - oldY - 1))
mv ${zoomX}/${oldY}.png ${zoomX}/${newY}.png
done
Now, even if your image is not actually a map or something that would be reasonably overlaid on a map, hopefully this gives you some ideas of where to look and what to poke around with if you want to leverage Google Maps. (There may be tools out there to let you easily build this type of functionality without Google Maps, but if so, I have no experience with them.)
There's Google Maps, of course. I'm totally serious: GMaps API allows you to create custom map types, you'll need to give it a way to show the "tiles" (parts of your image) at a given zoom level.
The most work I'd assume would be in creating the "tiles" from your image at various zoom levels (split the image into smaller rectangles), but I suppose that can be automated. The UI, dragging, zooming and whatnot is then handled by the JavaScript script of Google Maps.
(this works, I've made a boardgame with such custom tiles, using Google Maps as the underlying framework for showing it.)
I've just found this library, which is quite slick: http://polymaps.org/