Google Vision API - Problems with spaces and table lines in OCR - google-cloud-vision

I would like to know if there is a way to fix these two types of read errors:
Sometimes two numbers apparently very distant from each other are joined.
"description": "723"
union of two distant numbers
Sometimes the table lines are recognized as 1.
"description": "14,5" line that becomes a 1
Thanks for any reply and let me know if you need more information

Related

How to find all places, which belong to a category like atms in an area, which is defined according to a radius or some latitutes and longtitutes?

I have to get all places, which belongs to a category like restaurants, atms, hospitals in an area according to a radius or some latitutes and longtitutes, which is defined by the user. As an example, imagine I want to get all the ATMs in an area. This area must be abled to define for the user. I want to get all these atms in that defined area. I couldn't find a query in APIs to fulfill my requirement. Can you please help me to do this?
I tried Google places api to do this. Following is one of a query I tried.
https://maps.googleapis.com/maps/api/place/nearbysearch/json?location=6.927079,79.861244&radius=1500&type=atm&key=YOUR_API_KEY
I couldn't get all atms using this query. The output was limited in this case.
And I also tried Places (Search) API in Here Maps. But I couldn't find a way to fulfill my requirement.
Maybe the manual is misleading. It says that a query is required, but you can actually just do a browse/ query without a 'q' if a 'cat' is specified and you'll get all of the responses with that category near your 'at' (or restricted to your 'in'), sorted by distance.
So, to get 50 ATMs near the center of San Francisco, you can use a query like https://places.api.here.com/places/v1/browse?at=37.7672%2C-122.4425&cat=700-7010-0108&size=50&cs=pds...
For restaurants, it's a bit more complicated since there are many different kinds of restaurants and they all won't necessarily have the "Restaurant" category. Some might only have "Fine Dining", for example. But 'cat' can be a comma-separated list of categories, so the user can specify all of the subtypes to make sure they get all of them.
You need to set cs=pds and use the category ids from the places-category-system documentation reference below, so if users are typing in category names you'll have to do some transformation in your code. If you are interested in looking for specific types of restaurants like Chinese or Italian, there's a set of food types that can also be put in the 'cat' parameter (ids need to be used there as well)
https://developer.here.com/documentation/places/topics_api/resource-browse.html
https://developer.here.com/documentation/places/topics/place_categories/places-category-system.html
https://developer.here.com/documentation/places/topics/place_categories/food-types-category-system.html

Number of the places listed at a specific bbox

Currently having a problem about the number of the results when I search for the places by using bbox coordinates of an area.
My questions are:
1) Is there any solution to get more than 80 results per search? -might be 500 max-
2) (This question is for https://developer.here.com/) If there are more than 80 places at a specific bbox how do you select the results you list-because you list max. 80 of them?
Thank you.
Your question is quite general. Let me answer it this way, with the REST API, there's a parameter 'size' which specifies "The maximum number of result items in each collection." (note you are not guaranteed to always get back that many POIs).
There should be similar parameters in the SDK or other ways of accessing the search system.
On their page they already say they only list "popular places" within a specified area.
https://developer.here.com/api-explorer/rest/places/explore-places-bounding-box
They explain how "popularity" is being calculated as well. "The popularity of the result, e.g. number of clicks, number of times it has been saved as a "favorite".
https://developer.here.com/cn/documentation/places/topics/search-results-ranking.html
The conclusion is if you are using Search (Places) API by using bounding box coordinates of an area and if bounding box has more than 80 places in it, results are pretty inaccurate. Thank you.

What does the dedupe parameter do in the Nominatim Search API?

It seem like it's doing more than just removing duplicates but I can't find any good documentation on it. The API docs currently just say:
dedupe=[0|1]
    No explanation yet.
I'm running my own Nominatim that's been forked from the original a few months ago and I use the public Nominatim as a back up when mine doesn't respond. So I am interested in answers regarding the latest public Nominatim. On my own Nominatim, I haven't noticed duplicates in results.
I have noticed differences when setting dedupe to 0 or 1. Here's a diff where you can see that even with dedupe=0, there are no duplicates yet with dedupe=1, the results are different. BTW dedupe=1 seem to match the default with no dedupe set.
Maybe Nominatim is removing duplicates based on GPS and boundaries and not just place_id's?
you could check the source code in here. Basically, the dedupe parameter is used to check whether there is a duplicate on the search result or not. it will be used when generating the query to get the data from the database.
the parameters which are used when trying to check for duplication are place_id and the address (the country code, postcode, address, etc). you could check the sql function in here (the function is called get_address_by_language)
I have not heard of the dedupe parameter but found your question while searching for nominatim duplicate addresses.
I'm having an issue with some buildings existing twice in the Nominatim data with slightly different variants of the address (e.g. Avenue vs Boulevard suffix, front door vs back door as coordinates).

Google store locator library limit markers in right hand panel

I'd like to limit the number of markers that appear on the map in the right hand panel to something like 10 at any zoom level.
How can this be achieved?
The library can and examples can be found here:
http://storelocator.googlecode.com/git/index.html
I am following the code example given here:
http://storelocator.googlecode.com/git/examples/panel.html
There is a code reference here:
http://storelocator.googlecode.com/git/reference.html
But it's still not clear to me exactly how I can customise the example I am following so that it only shows a maximum of 10 markers at any one time.
EDIT : Why I want to do this
I sell a product wholesale to many salons. With this map I am trying to show customers which salons they can go to buy the products I supply.
However in the example given by google, the full list of salons appear as markers on the map. This is not good because it is then possible for competitors to glean an entire list of salons that they can market competing products to.
The solution I'd like would be to only show a maximum of 10 markers at a time according whichever is closest to the inputted address.
For me the example( http://storelocator.googlecode.com/git/examples/panel.html ) always show only up to 10 entries in the panel. There is a hardcoded limit of 10 , so it's not possible to achieve it without modifying the store-locator.min.js
But when you wan't to display less than the 10 entries, it would be possible via CSS:
/* limit the displayed entries to 5 */
.store-list li:nth-child(n+6){display:none}
When you want to apply a higher limit(or when it should be compatible with IE<9) edit this part in store-locator.min.js(line 28)
m=e.min(10,c[E]);
(set the 10 to the desired value)
To limit the number of results at all edit this line in MedicareDataSource.prototype.parse_
for (var i = 1, row; row = rows[i]; i++)
and set it to
for (var i = 1, row; row = rows[i],i<XXX; i++)
(where XXX is the limit +1, so e.g. setting XXX to 11 will apply a limit of 10)
There's a few general approaches, and the better solution depends a bit on your total number of stores you have, and how hard you want to make it for someone to scrape.
You could continue to use the static data feed like in this example (which means sending all stores to the browser on load), and then add some logic to only display the closest 10 (such as setting the map to null for all markers that aren't also shown in the panel), but this is not a good solution if:
there are lots of stores (more than a thousand or so) since it will be unnecessarily slow to load them all when only displaying a few.
you don't want someone to look at your code and just grab the full CSV you're sending down the wire with all your data.
Given your scraping concern, a better method is probably to implement the store locator using a dynamic datasource that only returns the closest N records for a given lat/lng so you don't expose the entire thing at once. Using Google services you could use Maps Engine which has an API, and the store locator includes a Google Maps Engine example you could start with. Your security concern here is if these queries are publicly available for anyone to hit directly, the table is also public and then someone could query for the full table. So you'd want to put a proxy inbetween to avoid that type of query hack (although of course someone could just feed you lots of locations to eventually get all your stores if they really wanted).
Other options (again just looking at Google's stack although there are lots of alternatives for this kind of thing, like CartoDB and many more) include AppEngine's Search API which also returns the N closest items (but would require some server side coding which Maps Engine would not), or even put the data into Google spreadsheets and implement a basic Script -> Web Service, where your script takes the lat/lng and do some basic math to find the closest.
Again if you don't love the server side aspect then Maps Engine is probably your best bet for a quick start especially given there's a working sample in the storelocator code.

Gviz only showing first part of fusion table on Google Map

I modified one of Geocodezip's examples to use my fusion table. The table is 40+ rows but only the first 11 are displaying on the map. Everything geocodes OK from within the fusion table but not here. Can someone please explain why.
http://6tango.com/Map_Examples/fusion_with_geocode.html
[EDIT] I just noticed that Geocodezip's example only has 11 points. Guess I'd better look at his javascript closer.
On another note, is there an easy way to show a block of code here without manually adding spaces to each line? (please excuse my ignorance)
PS - Thank you Geocodezip for all your examples. For a newbie like me they are a God-send!
You are geocoding the entries in the table on the fly, check for the case when status != google.maps.GeocoderStatus.OK, you will find you are getting OVER_QUERY_LIMIT responses.
I would suggest geocoding the addresses offline (or capturing the coordinates from the points that are displayed) and adding the resulting coordinates in additional columns of the table to avoid the problem.

Resources