I'm requesting some drinking_water nodes by id:
node(id:1560728638,
1560728638,
1835271176,
1844271135
); out body;
I'd like to request the name of the city where the nodes are, for example:
osm_id
city
1560728638
city A
1560728638
city A
1835271176
city B
1844271135
city C
Is it possible?
In your case, the nodes already have a city tag: "addr:city"
You can ask and search question about overpass, OSM and various geographic queries on gis.stackexchange.com, it might be more focused that here.
Anyway, you can run the following query on overpass turbo:
// output to .csv file, with columns
[out:csv(::type,::id,amenity, name, "addr:city")];
// list of nodes
node(id:1560728638,
1560728638,
1835271176,
1844271135
);
//for each node:
// print the node,
// then get the surrounding (is_in),
// filter that for cities (admin_level 8),
// and return they city
foreach->.d(
.d out;
.d is_in;
area._[admin_level~"[8]"];
out;
);
So you get a list of your original nodes (in a different order), and the city they're in.
They you can just extract the data from the file o put in in the format you want:
#type
#id
amenity
name
addr:city
node
1835271176
drinking_water
Privas
area
3600087515
Privas
node
1560728638
drinking_water
Privas
area
3600087515
Privas
node
1844271135
drinking_water
Saint-Etienne-de-Serre
area
3602084772
Saint-Étienne-de-Serre
Related
I am quite new to programming and currently self studying jupyter notebook for data analytics. I just need to know whether we can execute a data frame object inside and if else statement.
First I read city name from user and check whether the given city is in the data frame. And then filter the dataframe according to the value given by user. If city is not there, print that the city is not here. I need to know is there any method to execute this in a good way. This was my silly try. If someone can help, would be a big help
cityname = input("Input the name of the city to see the data required")
if totaldata['City'].any() == cityname:
totaldataCitywise = totaldata.loc[totaldata['City'] == cityname, :]
totaldataCitywise
else:
print('The city is not in the list')`
I'm using overpass-turbo to extract street names data from OSM. Here's the code I've been using:
[out:csv ("name")][timeout:2500];
{{geocodeArea:Ouagadougou}}->.searchArea;
(
way["highway"]["name"](area.searchArea);
);
for (t["name"])
{
make street name=_.val;
out;
}
How should I modify the code so the output is street names with the corresponding area name?
[out:csv ("name")][timeout:2500];
{{geocodeArea:Ouagadougou}}->.searchArea;
(
way["highway"]["name"](area.searchArea);
);
for (t["name"])
{
make street name=_.val;
out;
}
Output is street names only.
I am searching for plugin from which I can get province and cities for one country only. Mean I dont want to select country.
I have found this plugin which is good but issue is its asking for country pick.
https://pub.dev/packages/restcountries
From the examples at this link
List cities = await api.getCities(
countryCode: 'id', region: 'Jawa Timur', keyword: 'mal');
Since you already know which country you want to get the cities from, just assign that country's code to countryCode,
For example, if you want cities of United States with keyword ar,
List<City> cities = await api.getCities(
countryCode: 'us', keyword: 'ar');
I have to agree with the above answer. Given a County you could make a series of calls to get the data set you want.
countries = await api.getCountries(); -- Will return the countries the service has, then search through the list to find the one you want.
regions = await api.getRegions(countryCode: 'id'); -- Will then get you the regions for the country, I'm assuming you'll get the code from the first call, otherwise a good place to start with the code would be to use the the IEEE country codes.
Check Them Out Here
Finally use the regions you got to get the cities;
await api.getCities(countryCode: 'id', region: 'Jawa Timur');
Bringing it all together you'd have something like this... (I have not looked at the API specification so the guess at a memeber in that loop "region.name" is likely incorrect)
import 'package:restcountries/restcountries.dart';
void main() async {
var api = RestCountries.setup(Platform.environment['API_KEY']);
List<Country> countries;
List<Region> regions;
List<City> cities;
countries = await api.getCountries();
// Search here for your country
regions = await api.getRegions(countryCode: '*YOUR COUNTRY CODE HERE*');
// Now we loop to get cities in every region.
regions.forEach((region){
cities += await api.getCities(countryCode: '*YOUR COUNTRY CODE HERE*', region: region.name);
});
print(regions);
print(cities);
}
We have following structure in MongoDB documents.
{
"id":"1111",
"keys":[
{
"name":"Country",
"value":"USA"
},
{
"name":"City",
"value":"LongIsland"
},
{
"name":"State",
"value":"NewYork"
}
]
}
Now using Springframework Query object, I figured out a way to pull the details using below syntax
query.addCriteria(
Criteria.where("keys.value").is(countryparam).
andOperator(
Criteria.where("keys.value").is(stateparam)
)
);
Two issue with this query model.
First issue is it is irrelevant if countryparam and stateparam are actually meant to match Country key name and State key name respectively. If just the values matches, the query returns the document. Means, if I have Country and City params, this just works if user passes Country and City values, even if they are swapped. So how can I exactly compare City to cityparam and State to Stateparam?
More complexity is if I have to extract the document basing on multiple key value pairs, I should be correspondingly able to match key name with respective value and query the document. How can I do this?
Thanks in advance!
I have an index that includes these attributes: Name, Address, City, State, Zip
I want to do a allOptional search but I don't want city, state, or zip to match without name or address also matching. So a search query of McDonalds would match all McDonalds in every city/state, McDonalds Chicago would return all McDonalds in Chicago and McDonalds 60007 would return all McDonalds in the zip code 60007.
But a search query of Chicago or Chicago IL would return 0 results.
I've been reading the filters and facets documentation and I think this should be possible with a filter but I can't seem to figure out how.
You can solve this issue by post processing results after you have received them, before rendering them.
You can use the _highlightResult data in the hits response to filter out hits in which the query isn't matched in certain attributes.
For instance to remove hits where the query isn't matched in either the name or address attribute:
var displayedResults = response.hits.filter(hit => {
return hit._highlightResult.name.matchLevel !== 'none' || hit._highlightResult.address.matchLevel !== 'none';
});