Using Leaflet with Google Maps? - api

Currently I am using Google Maps API 3 to display about 1000 users spread all over the world. This is for free, as long as I have less then 25.000 downloaded maps views per day.
Recently, I found out about the amazing JS Library Leaflet. I want to use it with OpenStreetMaps. As far as I have understood, one should not use tiles provided by OpenStreetMaps (Tile usage policy) but instead third party provider that makes tiles from OSM data, or generate your own.
I cannot provide my own tiles because I do not have appropriate hardware requirements.
Unfortunately I found that many third party provider for tiles have very strict limits, like MapQuest which is only for free as long as you do not exceed 15.000 map views per month (which seems not very attractive in comparison with Google Maps where you can use it for free as long as you do not exceed 25.000 map views per day).
So I wonder, is it possible to use Leaflet with Google Maps, so that I only have a limit of 25.000 map views per day?
According to this question the answer is clearly no.
However, according to Leaflet Map API with Google Satellite Layer the answer is yes.

Well, a lot to say here.
1) You can use OSM tiles as long as your usage is reasonable. If you find MapQuest limits quite restrictive, then indeed, you would probably be in the "over-reasonable" situation.
2) You have plenty 3rd party alternatives for tile sources (including MapQuest and Google Maps). If you are in the situation where you generate several thousands of views per month or day, then it is probably worth paying for a commercial service and ensure some availability service level. Of course Google Maps is still free and attractive for a high usage, at the cost of complying with their conditions (below).
3) Google Maps terms state that you can use Google Maps tiles only through Google Maps API. That is what some Leaflet plugins provide: they act as a proxy and use Google Maps API, so you should be compliant with Google Maps service terms. That is where you should probably provide your API key.
4) Therefore, the code snippet you show, which directly uses Google Maps tile template URL, is very probably not compliant with their terms, even though it may technically work.
As a side note, among the commercial 3rd party services for tile source, there is Mapbox. I do not especially like advertising, but I mention it because this is the company where the main Leaflet author works.

Related

Structured Data Schema Types for Trading Card Game Cards

So, I run a website which has a card database for the old Star Wars Trading Card Game by Wizards of the Coast. swtcg.com There are multiple sets/expansions and each of those has multiple cards.
If you google other trading card games like Magic the Gathering or Pokemon TCG, you SOMETIMES will get rich, carousel-style results for individual cards, and if you click one of the cards, you get the rich, graph sidebar result. It seems like google is aware that these are Cards from Sets for a Trading Card Game.
I have tried to search for sites that are using structured data to identify these types, but have only found one or two, and they are just using Product markup.
Does anyone have any advice for what types I should use? I would really like to get to the point where you could search for a card and could get a rich result on the side with details about each card.
I've tried Product, but only some of them are cards that are actually sold. Others are digital only and free. I've considered Article and Creative Work, but am just really stumped as to what the best options would be for me. Is there such a thing as custom types that aren't insanely difficult to implement?
The contents of your website present a database for playing cards. Let's look at your web page representing one card 100 Battle Droids. In my humble opinion, this content is explicit Creative Work and this type can probably help you. Due to the fact that the subject of this web page is a game, the use of the embedded type Game can help you. For this type, you can use the about or mainEntity properties as alternatives.
The map that is presented in the content of this web page is an image. You can probably be helped by using the following Google guidelines for structured data for the Article type:
For best results, provide multiple high-resolution images (minimum of
300,000 pixels when multiplying width and height) with the following
aspect ratios: 16x9, 4x3, and 1x1. For example:
{
"#context": "https://schema.org",
"#type": "NewsArticle",
"image": [
"https://example.com/photos/1x1/photo.jpg",
"https://example.com/photos/4x3/photo.jpg",
"https://example.com/photos/16x9/photo.jpg"
]
}
You can use the free online calculator for the following aspect ratios:
4X3 and 16x9. To compress your images, you can search for image compressors on the web. I usually use Compressnow with the maximum level of 65%.
Using the Google Guides to optimize your images Google Image best practices and UX to responsive images.
Your information below the card is the table. The use of a responsive table (row only) for this data may probably help. You can use the W3 guide Generating JSON from Tabular Data on the Web to structure this data.
You can use Google guide to Dataset and the standard of W3 Data Catalog Vocabulary (DCAT) - Version 2 to create a database of your cards.

How many objects these Computer Vision API can detect?

https://learn.microsoft.com/fr-fr/azure/cognitive-services/computer-vision/concept-object-detection
https://cloud.google.com/vision/docs/object-localizer
I would want to know how many and which objects are recognizable using theses APIs and I can't find a mention of that fact.
I found that google API use https://developers.google.com/knowledge-graph/ which is based on schema.org types but I don't really understand well what it's all about.
I'm sorry but as far as I know, there is no fixed list of classes that Azure Computer Vision is able to detect.
By the way, even if there was one, this list is evolving on a regular basis (but no schedule is announced).
In any case, there are limitations (see doc here):
It's important to note the limitations of object detection so you can
avoid or mitigate the effects of false negatives (missed objects) and
limited detail.
Objects are generally not detected if they're small (less than 5% of
the image).
Objects are generally not detected if they're arranged
closely together (a stack of plates, for example).
Objects are not differentiated by brand or product names (different
types of sodas on a store shelf, for example). However, you can get
brand information from an image by using the Brand detection feature.
If you want to detect specific objects, I would highly suggest using Custom Vision (doc / overview here), not Computer Vision, where you can train your model with your own images to match what you are trying to detect

Number of results google (or other) search programmatically

I am making a little personal project.
Ideally I would like to be able to make programmatically a google search and have the count of results. (My goal is to compare the results count between a lot (100000+) of different phrases).
Is there a free way to make a web search and compare the popularity of different texts, by using Google Bing or whatever (the source is not really important).
I tried Google but seems that freely I can do only 10 requests per day.
Bing is more permissive (5000 free requests per month).
Is there other tools or way to have a count of number of results for a particular sentence freely ?
Thanks in advance.
There are several things you're going to need if you're seeking to create a simple search engine.
First of all you should read and understand where the field of information retrieval started with G. Salton's paper or at least read the wiki page on the vector space model. It will require you learning at least some undergraduate linear algebra. I suggest Gilbert Strang's MIT video lectures for this.
You can then move to the Brin/Page Pagerank paper which outlays the original concept behind the hyperlink matrix and quickly calculating eigenvectors for ranking or read the wiki page.
You may also be interested in looking at the code for Apache Lucene
To get into contemporary search algorithm techniques you need calculus and regression analysis to learn machine learning and deep learning as the current google search has moved away from Pagerank and utilizes these. This is partially due to how link farming enabled people to artificially engineer search results and the huge amount of meta data that modern browsers and web servers allow to be collected.
EDIT:
For the webcrawler only portion I'd recommend WebSPHINX. I used this in my senior research in college in conjunction with Lucene.

Building GIS apps from scratch?

I am a very beginner in software and I am asking or a direction to proceed for research technologies to build my app. I am having just an idea for the app. I am trying to build something like zomato but different services. The idea of location based system is similar. I searched online and came to know about GIS systems. But while researching further, it seems I've to create a map all together. This feels redundant to build as we have api of google maps.
But can i use this api to build a system "ON" it????
Any tutorials or some direction in this direction would be helpful.
Also what is difference between GIS and gps based apps.
As you see, I am not very clear in the fundamentals of the GIS and GPS based apps
Thanks for the help
Regarding Android, you have almost all you need by combining the platform API and the comprehensive Google Maps Android API. Regarding the later, it's actually a matter of opting by convenience and possibly paying a licence fee to Google, versus developing your own solutions of aggregating free or cheaper services from elsewhere.
Most problems solved by apps are not the same problems solved by classical GIS software, since the former are more consumer-oriented (using public transportation, navigating a route, planning a trip, finding a nearby restaurant), and the later are more specialist-oriented, typically solving larger-scale and more technical issues (detecting regions with flood risk, monitoring deforestation, calculating volumes of terrain to be bulldozed, etc.)
You should not, IMO, be discouraged by the seemingly hard technical concepts of geography and map making. Your best bet is to have a clear vision of what actual problems you app should be solving, and study the geography topics gradually, as the need arises.
A bit of consideration on your question about GIS:
If it were created today, the GIS acronym would mean any software dealing with geographic data, be it a mobile app or a workstation software suite destined to specialized professional use.
But when it was created, the term meant almost exclusively the later sense, and so it has a lot of tradition and cultural legacy to it - which is of couse not always a good thing. Specifically (at least in my experience), it seems to me the jargon and concepts used by the classic GIS community are a bit impenetrable to the newcomer, specially if she comes from the software-development field instead of the geo-sciences field.
But geographic information availability has gone from scarcity to overwhelming abundance, and so have its enabling technologies: GPS satellites, mobile computing and mobile connectivity.

Random-access data object in J2ME

I'm planning to develop a small J2ME utility for viewing local public transport schedules using a mobile phone. The data part for those is mostly a big bunch of numbers representing the times when the buses arrive or leave.
What I'm trying to figure out is what is the best way to store that data. The representation needs to
be considerably small (because of persistent storage limitations of a mobile phone)
fit into a single file (for the ease of updating the schedule database afterwards over HTTP) fit into a constant number of files, i.e. (routes.dat, times.dat, ..., agencies.dat), and not (schedule_111.dat, schedule_112.dat, ...)
have a random access ability (unserializing the whole data object into memory would be just too much for a mobile phone :))
if there's some library for accessing that data format, a Java implementation should be present
In other words, if you had to squeeze a big part of GTFS-like data into a mobile device, how would you do that?
Google Protocol Buffers seemed like a good candidate for defining data but it didn't have random access.
What would you suggest?
Persistent storage on J2ME is a tricky business; see this related question for more general background: Best practice for storing large amounts of data with J2ME
In my experience, J2ME persistent storage tends to work best/most reliably with many small records rather than a few monolithic ones. Think about how the program is going to want to access the data, then try to store it in those increments in the J2ME persistent store.
I'd generally recommend decoupling your client-server protocol for downloading updates from the on-device storage format. You can change the latter with every code update, but you're pretty much stuck supporting a client-server protocol forever, unless you want to break older clients out in the field.
Finally, I know there are some people on the Transit Developers group who have built offline transit apps in J2ME, so it's worth asking for tips there.
I made app like this and I used xml-s generated with php. This enabled us to have a single provider for 3 presentation layers which were:
j2me app
website for mobile phones
usual website
We used xslt to convert xml to html on websites and kXML - very light pull parser to do it on j2me app. This worked well even on very old phones with b/w screens and small amounts of memory.
Besides on j2me there is no concept of file. You have the db in which you can store information.
This is a link to "mobile" website.
http://mobi.krakow.pl/rozklady/
and here to the app:
http://www.mobi.krakow.pl/rozklady/j2me/rjk.jar
This is in polish, but I think it's not hard to figure out what's this and that.
If you want, I can provide you with more help and advice or if this is a commercial product then I think we can figure out something too ;)
I think your issue is requirement 2.
Updating 10MB of data just because 4 digits changed somewhere in the middle of the file seems highly inefficient.
Spliting the data into several files allows for a better update granularity that will be well worth the added code complexity.
Real-time public transport schedules are usually modified one bus/train/tram line at a time.