styled maps with Subgurim Google Maps - subgurim-maps

It is possible to create a styled map with Subgurim Google Map control?
Here the code in according to Google Api V3.
var styles = [{
featureType: "all",
elementType: "all",
stylers: [
{ saturation: -100 }
]
}];
map = new google.maps.Map(document.getElementById("map_canvas"), myOptions);
var mapType = new google.maps.StyledMapType(styles);
map.mapTypes.set("mymap", mapType);
map.setMapTypeId("mymap");

I'm one of the developers of Subgurim Maps and this feature will be available in our next version, hopefully before the end of the month. As soon as we have it I'll inform you through this question.

Related

Google Maps API - return error if Lat/Lng incorrect

I have a Goggle Map displaying markers based on a list being pulled from a database via php. It all works OK but will display a blank grey map page if one of the lng/lats are incorrect.
eg: "510.51356, -0.7015494" rather than "53.8741174, -0.7015494"
I've tried:
var myLatlng = new google.maps.LatLng(510.51356, -0.7015494);
console.log(myLatlng);
Thinking it would return an error but doesn't - it returns an object but no data - but this is the same whether the lng/lat is correct or not.
Is there a way I can stop GoogleMaps from trying to add markers with incorrect lng/lats?
Below is the full code I'm using:
var myLatlng = new google.maps.LatLng(510.51356,-0.7015494);
var markerOptions = {
map: map,
position: myLatlng,
title: “MY LOCATION TITLE”
};
marker_3744 = createMarker_map(markerOptions);
marker_3744.set("content", "<strong>MY LOCATION TITLE</strong><br /><strong>Full address in here”);
google.maps.event.addListener(marker_3744, "click", function(event) {
iw_map.setContent(this.get("content"));
iw_map.open(map, this);
});```

appcelerator tableview seprators not showing

the separators in tableview are not showing
eg.
Ti.UI.backgroundColor = 'white';
var win = Ti.UI.createWindow();
var tableData = [ {title: 'Apples'}, {title: 'Bananas'}, {title: 'Carrots'}, {title: 'Potatoes'} ];
var table = Ti.UI.createTableView({
data: tableData
});
win.add(table);
win.open();
I have also tried
table.separatorStyle = Ti.UI.iPhone.TableViewSeparatorStyle.SINGLE_LINE;
table.separatorColor = "#000";
also tried running kitchsink,the separators are not showing at all
any ideas?
I recommend to use ListViews instead of TableViews: https://docs.appcelerator.com/platform/latest/#!/guide/ListViews
They give a huge performant boost on large lists. Also you have a better handling the design while using templates for ListItems.

How to edit OndemandGrid and update to the JSONRest Store

The JsonRest store I created is shown below
var questionBaseURL = "/" + contextName + "/service/questions/" + projectId + "/";
var questionStore = new dojo.store.JsonRest({
target: questionBaseURL,
handleAs: 'json',
idProperty: 'questionId'
});
questionStore = new dojo.store.Observable(questionStore);
var memoryStore = new dojo.store.Memory();
var questionCacheStore = new dojo.store.Cache(questionStore, memoryStore);
Which I use to render into the Grid created as below
var CustomGrid = declare([OnDemandGrid, Keyboard, Selection]);
var questionGrid = new CustomGrid({
store: questionCacheStore,
columns: [
editor({
label: "Questions",
field: "question",
editor: "text",
editOn: "dblclick",
sortable: true,
autoSave:true
})
],
selectionMode: "single",
cellNavigation: false
}, "questions");
questionGrid.startup();
questionGrid.renderArray(questionArray);
The data is properly populated in the grid. Now, since am using "editor", I am able edit the populated data in the grid. I am not sure how exactly to detect if the data has been edited (dirty data ) and which method to call to carry the updated data back to the server. I couldn't find any easy documentation. So any help is appreciated. Thanks in advance
You can use the grid's save method to push all items with dirty data back to the server. There is also a revert method which can be called to discard any dirty data. These are listed in the OnDemandList and OnDemandGrid documentation.
These methods are defined in dgrid/_StoreMixin which is inherited by OnDemandList (and OnDemandGrid). The editor column plugin calls updateDirty (also defined by _StoreMixin) when changes are made, which updates a dirty hash. save will check this hash and call put on the store for each dirty item.

Nokia map embed - hide labels and roads

Regarding embedding a Nokia map in a web page:
Anyone know how I can hide roads and names. Like on here.com they have a checkbox under feature to hide 'labels'.
This is what I have so far:
var map = new nokia.maps.map.Display(document.getElementById("map"),
{
'components': [
// Behavior collection
new nokia.maps.map.component.Behavior(),
new nokia.maps.map.component.ScaleBar()
],
'zoomLevel': 18,
'baseMapType': nokia.maps.map.Display.SATELLITE
});

Google Maps Places api, how do I get the standard infowindow content from a marker

New to Google Maps, and not a script expert either. Thanks in advance for any help you can provide.
I am putting a google map on a page of store locations. I have managed to get the map to display the marker I want for the store location using the search. Now I want the infoWindow to be populated to look like the standard google window. But using the code I was able to find on the places library, the results show up unformatted with no line breaks, and shows errors if a piece if information is missing, etc... I have searched and didn't find anything that helped - so please forgive me if this is already answered - and I have read through the google places library numerous times so either I am dense or they just don't address this specific question.
The user will click on a store location listed on the page and I want to show them the map with the one marker (through search I think I can get that to happen) and I want the store information show up in the infoWindow when they click on the marker (preferably I would like the infoWindow already opened but I couldn't find anything on that either). Since I am new to the site I can't post an image of the infoWindow so hopefully it's not needed. Like the google's map website, I want a nicely formatted name, the reputation stars, a formatted address, phone number and website, along with a picture of the business if it exists. The example I use below is for a business where all of this information exists within google. The code I currently have for the map is included.
Please don't reply simply to direct me back to the places library; if that's all you have then it is not helping. I need some clarification and ideally an example. Thanks.
<script type="text/javascript">
var map;
var service;
var infowindow;
function initialize() {
var mvale = new google.maps.LatLng(40.708572,-74.017385);
map = new google.maps.Map(document.getElementById('map_canvas'), {
mapTypeId: google.maps.MapTypeId.ROADMAP,
center: mvale,
zoom: 16
});
var request = {
location: mvale,
radius: '500',
keyword: "Michelle Vale"
};
infowindow = new google.maps.InfoWindow();
var service = new google.maps.places.PlacesService(map);
service.search(request, callback);
}
function callback(results, status) {
if (status == google.maps.places.PlacesServiceStatus.OK) {
for (var i = 0; i < results.length; i++) {
var place = results[i];
createMarker(results[i]);
}
}
}
function createMarker(place) {
var placeLoc = place.geometry.location;
var marker = new google.maps.Marker({
map: map,
position: place.geometry.location
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.setContent(place.name + place.rating + place.vicinity +
place.formatted_address + place.website );
infowindow.open(map, this);
});
}
function openInfoWindow(id){return true;}
google.maps.event.addDomListener(window, 'load', initialize);
</script>
I finally located some code for formatting the infoWindow in another post where they were answering a question about removing the border for the infoWindow.
Here is my example :
infowindow.setContent('<span style="padding: 0px; text-align:left" align="left"><h5>' + place.name + ' ' + place.rating
+ '</h5><p>' + place.formatted_address + '<br />' + place.formatted_phone_number + '<br />' +
'<a target="_blank" href=' + place.website + '>' + place.website + '</a></p>' ) ;
I also figured out how to use the getDetails function described in the Places Library
I still don't know how to get the rating information (I'm using the tag but it gives an error), how to retrieve the image for the location, nor how to eliminate the "undefined" error from appearing.
Last element is to have the infoWindow open when the map loads... I saw a post about it but couldn't get it to work.

Resources