OpenStreetMap: .OSM or .OSM.PBF export all streetnames and matching cityname and postcode - export

I'm trying to get a table of all streets of a entire country, which means the file I'm working with is big. I want the streets to be in this kind of pattern:
column 1: street name; column 2: city name; column 3: postcode; (optional) column 4 suburban name;
Can be in a different format as long as every street has its postcode and city, so I can work with it.
I've already had success by going line by line and checking for a addr:city and then check the next lines for addr:street, addr:postcode and addr:suburban. There is just one problem: There are addr:street without an addr:city or addr:postcode so that only works for 72% (percentage of streets with city and postcode) of the streets. The other 28% can't be connected to any city nor postcode.
I've tried to work with osmfilter but I can't get it to work :(
help is greatly appreciated.

Related

Filter an address column to only show the city

I have a retail database in Arabic, the addresses are written in Arabic, I have found a way to turn the letters to numbers to maybe make it easier for me, however, I am struggling to filter only the city name from the columns.
The problem is that the address is very specific, they are more of directions and they are generally written in the format of ( city, street, building name, nearby landmark ) but most of the time it's only written as the city only.
Is there a way to extract only the city from all the addresses?

MS Access: Search through Table for the same part of the String

I am trying to loop through Column Values inside my Table.
I have a register form, which provides the user with UNIQUE ID, based uppon his information.
For example:
Country = Austria
Each user that selects country Austria will get some sort of Unique Value for that match (lets say 00).
Account ID look like this:
XXXX00UNIQUECODE
Each country has it´s own unique value: (AT = 00, DE = 01, etc)
Now, I want to generate a UNIQUE CODE for each user, that will be just an increment (+1) value of the previous UC value stored in the table, for the same country!
In order to do that, I need to somehow loop through the Column, where the Account IDs are stored and search for the match.
The thing is, when a user tries to generate the UNIQUE CODE, he does not have it yet, so he has only:
XXXX00
Now I need to find all the XXXX00 strings in my AccountID Column, and store them in an Array - then find the Max Value of those and increment it.
BUT I dont know how to search for a part of the string inside a Column of the Table ?
Just the XXXX00 part, not the entire Account ID XXXX00UNIQUECODE.
Agh, I hope you can understand me. It´s quite complicated I know, but I´m really stuck here. Hopefully, someone will know what I mean and maybe even find a smoother solutions for this.
Thanks in advance!
You're pounding a square peg into a round hole. Why not just create a new column called UserID and then you can do:
SELECT Max(UserID) FROM MyTable WHERE Mid(AccountID, 5, 2) = "00"
and increment it by 1.
Better yet, store CountryCode, UserID and the XXXX part in separate fields, and index them. It'll save time when you search or filter, which I'm assume you're going to be doing.

MS Access Age Calculation across tables

I'm editing a database template so I can track differences in patient tests across age for the same person.
I retro-fit the "Student Database" template to utilize the forms and macros already created.
I have a patient table that stores all data collected at initial intake : name, date of birth (DOB), etc. and a second table that would track test scores across visits that includes : name, date of visit (DOV) and score information. These are paired so I can pull up information from one patient and see their scores across visits.
What I need to do now is create a query where I can calculate their age when they took the tests.
To do so, I have used expression builder and entered Calculated:([Visit Date]-[DOB])/365
This works for calculating age only if I re-enter the DOB in a new column on the patient visit table
I've tried using DateDiff and using [Patient]![DOB] to recall the data from the other table but I get the same error.
(Calculated age: ([Patient Visit]![Visit Date]-[Patients]![DOB])/365)
Calculated age: (DateDiff("yyyy",[Patients]![DOB],[Patient Visit]![Visit Date]))
Both spit out the error : Enter Parameter Value 'Patients!DOB'
If I enter a date, all data points and patients calculated to have the same DOB that I entered.
How do I let Access know I need it to calculate the date at visit for the DOB of the same patient?
?: Do I need to create a lookup table for the patient ID to match with the DOB and then use that field for calculation?
If there is something wrong with the expression I can fix, that would be ideal. If not, what is the best way to calculate age at visit without having to manually enter in the patient DOB more than once (once in initial uptake and again at each visit).
Thank you in advance.
I found a solution!
I was using 'query' wrong. instead of trying to force it to recognize another table, I needed to add the table to the query upon query creation.
i.e.:
1_ selected 'Query Design'
2_ selected the tables with the required information (entered through forms)
3_ Used `
Patient Name: IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[First Name]),IIf(IsNull([First Name]),[Last Name],[First Name] & " " & [Last Name]))
`
for the first field and
Patient Visit.*
for the second field. By adding "Patient Visit.*" the query will add all fields from the table into the query.
The third field I selected DOB from the Patients table (it was available for selection because I had the two tables selected in the layout initially).
I am now able to use the original
Calculated:([Visit Date]-[DOB])/365
for age calculation w/o any error. I finalized formatting under properties > format > fixed.
Wooo!

Vlookup array multiple columns

Excel wiz's,
I'm trying to build a report with a simple drop down list of names. Rather than try to explain in more detail, let me give you a sample dataset:
Table1:
Text Person1 Person2 Person3
String here contains name(s) Mike Smith Robert Johnson Suzy Q
Another string with name(s) Dan Boy John Michael Bob Wise
Different string with name(s) Robert Johnson Suzy Q
In my report sheet, I have a drop down list of all the possible "persons" that I want to chose from and then return all values from the "Text" column in an array. I have been able to make it work with only one column using this formula, where C4 contains my choice in the dropdown list:
INDEX(Table1[#All],SMALL(IF(Table1[Person1]=$C$4,ROW(Table1[Person1])),ROW(1:1)),1)
The text column will contain all the names of the Person columns, but they are in a different case (all caps, can't change format for display purposes). Maybe a SEARCH function would be more useful? I'm not sure. I'm trying to avoid using a macro, but I am not completely opposed.
Let me know what you guys think, and thanks in advance!
Simply re-organize your table so that there's one row per name... the V-Lookup on the name and get the matching list.
Person Text
Mike Smith String with names
Robert Johnson String with names
Suzy Q String with names
Dan Boy Second string with names
are you trying to make validations for teams? like select team, then next drop down gives only members of that team?
you can use offset inside validation. in one cell put a validation for the list of teams. in the other cell, create a list validation, use a offset formula to return the range of members based on the selected team.
edit: not sure how to put in a table, but this is how you would fill a range with vlookup
in the table with the entries, add a column with serial number starting from 1-n
just below the drop down box, enter numbers 1 to n in order
vlookup the serial number in the table, that is the row you are looking up
for the column, use a match to look in the table which column the current selected person is
drag the formula down to fill n numbers

How to find the minimum fields needed to identify a unique row in a set of data

Say I have a bunch of data on some people. This could include Name, DOB, Address, Email, etc... Assume there are no unique identifiers (like an id column) on this data, but also assume that there are no repeating rows. I need to figure out the minimum set of fields I can use to query that data and return a unique row.
An example of a solution would be: "I can make a query that specifies a first name, dob, email, and zip, and that would return exactly one or zero rows."
Did I ask that in a way that makes sense? I am looking for a technique, algorithm, or software package that would solve this problem for a given set of data. Anything that could provide an answer would work. Thanks!
EXAMPLE DATA (the real stuff is much more complex):
FNAME LNAME DOB ZIP email
John Smith 1/1/12 77777 dude#fake.com
Sean Smith 1/2/08 77777 dude#fake.com
Sean William 4/2/07 77789 stuff#fake.com
Richard Ross 1/1/12 78989 foo#fake.com
The solution for this set of data would be (FNAME, LNAME) or (EMAIL, DOB) or (EMIAL, FNAME).
i think you will need an iterative approach.
perhaps you can begin with each column, and attempt to create a unique index.
if you have success, then done.
if you are unable to create unique index then add another column and try again.
do this for all columns until you can successfully make the index.

Resources