Retrive all districts based on city name from REST query - rest

I've searched for solution for that problem on here-api documentation but I can't really find it out ! I'm starting doubt if this even possible.
Ok so basicly what i need to know for now:
1. Is this even possible on this platform ?
2. Using exactly which 'module' (eg. PLATFORM DATA EXTENSION,BATCH GEOCODER)

There is no straight solution to get all districts in a city since district concept varies from one place to another(country-specific). Still you can try one of the below options:
administrative-areas-buildings category in places api
city-town-village category in places api
retrieveAreas mode in geocoder api (apply bbox or increase the radius of prox parameter and see if it works for your location)
Search Text in geocoder can also be used if you are search for districts which match a regex
You can check if the above 1) and 2) are applicable to your location using https://places.demo.api.here.com/places/v1/categories/places?at=41.8369%2C-87.684&app_id=DemoAppId01082013GAL&app_code=AJKnXv84fjrb0KIHawS0Tg

Related

Gremlin: Generate a list by location of counts for active versus inactive users

I have vertices people, usertype, and location. People has outgoing edges people_location and people_usertype. People has property 'name', usertype has property 'activationStatus', and location has property 'name'.
I want to create a list that looks like this:
[[1]: https://i.stack.imgur.com/lKzZL.png]
I want the count of people, by location, for activationStatus "active" and "inactive" where the location has "US" in it.
This is all I have only for count of people by location where the location 'name' begins with US:
g.V()hasLabel('people').out('people_publicisofficelocation')
.filter(has('name',between('US','UT')))
.groupCount().by('name')
It is running but not yielding results.
You can simulate 'starts with' behavior in versions of TinkerPop prior to 3.4 using something like has('name',between('US','UT')) so you could replace the filter line above with that. If the graph implementation you are using supports TinkerPop 3.4 there are additional text predicates you can use for begins with, ends with and contains.
As others have said if you can post some sample addV() and addE() steps that build part of your graph it will be easier to give a more precise answer.
This worked for me!
g.V().hasLabel('Location').filter(has('name',between('US','UT')))
.project('Name','Active', 'Inactive', 'Total')  .by('name')  .by(__.both('people_location').out('people_usertype')
.where(values('activationStatus').is(eq('Active'))).count())  .by(__.both('people_location').out('people_usertype')
.where(values('activationStatus').is(eq('Inactive'))).count()) 
.by(__.both('people_location').out('people_usertype').count())

Twitter advanced search by date AND location for research purposes

I'm trying to research a topic and I need to get all tweets within 2013 and 2015 and a specific location for two keywords.
I tried to get the results via Advanced Search but I allways get no results.
I tried:
cannabis near:"España" within:15mi since:2013-10-07 until:2015-01-01
cannabis near:"Spain" within:15mi since:2013-10-07 until:2015-01-01
Basically, I have a database of scraped press articles sorted by date from a bunch of sources, and I want to know how the agenda of this news sources have an impact on the social media conversation.
I could do it over Reddit if it was the case for the US, but there's no Spanish alternative (well, we have Meneame, but the user base is very left-leaning and I think it will be very narrow).
So I wanted to either scrape the search results or get them via API, but It's not working, and AFAIK I can't do anything similar with Facebook.
One way to achieve this is by using Twitter's geocode operator. In the example below i took Madrid as a center and covered a radius of 600km around it like this:
(canabis OR cannabis) geocode:40.4381311,-3.8196196,600km since:2013-10-07 until:2015-12-31
Try it...
The syntax is as follows:
([your_boolean_search_query]) geocode:[latitude],[longitude],[radius]km since:[] until:[]
one easy way to find latitudes and longitudes of locations is to use Google Maps. Simply navigate to a place using the search box and then copy the latitude and longitude element from the URL line in the browser. Here it is for Madrid. The latitude and longitude are right after the # sign, separated by a comma:
https://www.google.com/maps/place/Madrid,+Spain/#40.4381311,-3.8196196,54451m/data=!3m2!1e3!4b1!4m5!3m4!1s0xd422997800a3c81:0xc436dec1618c2269!8m2!3d40.4167754!4d-3.7037902?hl=en
Try it...

Facebook graph api where location equals

I'm trying to search pages which location city equals to xyz.
For example find page Guiness in city = Wroclaw, it looks like this:
/search?q=Guiness&type=page&city=Wroclaw
But it doesn't work ?!
I tried many different ways.
I think the problem is in that the location is complex type, but I can't find in documentation how to search by complex type :(.
Hope help will came soon.
Thanks !
It's clearly documented what is possible with the /search endpoint:
https://developers.facebook.com/docs/graph-api/using-graph-api/v2.5#search
You can't use other parameters than outlined there. Either this would be
/search?q=Guiness%20Wroclaw&type=page&fields=id,name,location
or search for a place with center coordinate and a distance:
/search?q=Guiness&type=place&center=52.231804,21.007973&distance=5000

Google Places API autocomplete specific city

I have some questions about google places api for android.
This is the request that is being called:
https://maps.googleapis.com/maps/api/place/autocomplete/json?sensor=false&key=API_KEY&components=country:hr&language=hr&input=lad
The issue is that I want only addresses within specific city. Is that possible?
Here is the quote from
Google Places API autocomplete
that suggests that it should work.
Blockquote the (regions) type collection instructs the Place service to return any result matching the following types:
locality
sublocality
postal_code
country
administrative_area1
administrative_area2
Blockquote the (cities) type collection instructs the Place service to return results that match either locality or administrative_area3.
So I would like to specify citry or a postal code in order to filter only addreses from that city.
--EDIT--
This approach doesn't work either.
maps.googleapis.com/maps/api/place/autocomplete/json?sensor=false&key=API_KEY&types=geocode&location=45.811093,15.974121&radius=12000&components=country:hr&language=hr&input=lad
Solution
I've added CIty name in input string
city_name+street like Zagreb+fal in order to get all the streets from Zagreb with fal* in their name.
It seems to be working oke.

iOS 6 MKMapView Search for Places

I want to search for places such as "Apple Store", "Italian Restaurant" etc. and also for address such as "5th Ave, New York, NY, United States".
How can I search for places and set MKPlacemark for each place I find?
If you are worried about requests limit for Google Maps API, you can use some of open source maps API instead perhaps, like Nominatim API , look at http://wiki.openstreetmap.org/wiki/Nominatim
From iOS 6.1 Apple introduced a new search API - MKLocalSearch. You create a MKLocalSearchRequest using string and region to search in (the region is just a hint for the search, it doesn't guarantee results will fall within this region) and use this request to initialise a MKLocalSearch, which asynchronously gives you the results in an MKLocalSearchResponse object. It was only introduced in january, so it has it's issues at this stage - you only ever get 10 results per search, plus some of the results are strange, but it's definitely worth checking out. There's also no way to specify the type of object (town/business/landmark etc.) you're searching for, which is a shame. Here's a cool tutorial. Note that the more precise the region you supply the better the results.