How to filter out all amenities with osmfilter together with any other tag information they have? - openstreetmap

I managed to download a planet file from OSM, and converted it to o5m format with osmconvert, and additional deleted all of the author information from it, to keep the file size smaller. I am trying to fetch every POI from this database from the whole world, so I am not interested in cities, towns, highways, ways, etc, only amenities.
First I tried to achieve this by using osmosis, which as it appears manages to do what I want, only it always runs out of memory, cause the file is too huge to process. (I could split the file up to smaller ones, but I would like to avoid this if possible).
I tried experimenting with osmfilter, there, I managed to filter out every node which has a tag named amenity in it, but I have several problems which I can't solve:
a. if I use the following command:
osmfilter planet.o5m -v --keep-tags="amenity=" -o=amenities.osm
It keeps all nodes, and filters out every tag which doesn't have amenity in it's name.
b. if I use this command:
osmfilter planet.o5m -v --keep-tags="all amenity=" -o=amenities.osm
It now filters out all nodes which doesn't have the amenity tag, but also filters out all additional tags from the matching nodes, which contain information that I need(for example, name of the POI, or description)
c. if I use this command:
osmfilter planet.o5m -v --keep-tags="all amenity= all name=" -o=amenities.osm
Filters out every node which has EITHER name or amenity in it's tags, which leaves me with several named cities or highways(data that I don't need).
I also tried separating this with an AND operator, but it says, that I can't use AND operator when filtering for tags. Any idea how could I achieve the desired result?
End note: I am running a Windows 7 system, so no Linux based program would help me:|

Please try --keep= option instead of --keep-tags option. The latter has no influence on which object will be kept in the file.
For example:
osmfilter planet.o5m --keep="amenity= and name=" -o=amenities.osm
will keep just that objects which have an amenity tag AND a name tag.
Be aware that all dependent objects will also be in the output file. For example, if there is a way object with the requested tags, each node of this way will be in the output file as well. The same is valid for relations and their dependent ways and nodes.
If you do not want this kind of behaviour, please add --ignore-dependencies
Some more information can be found here: https://wiki.openstreetmap.org/wiki/Osmfilter

osmfilter inputfile.osm --keep-nodes="amenity=" --keep-tags="all amenity= name=" --ignore-dependencies -o=outputfile.osm
this is exactly what you are looking for:
keep nodes with the tag amenity (--keep-nodes)
keep only info about amenities and names (--keep-tags)

Related

How to tell what file a packet came from after files merged

I am dealing with a large number of pcap files from numerous collection sources. I need to programmatically filter and I am using tshark for that, so I am merging all the files together first using mergecap. The problem with that is I also need collection point information which is only available in the capture file name. I tried using editpcap to add in per-packet comments specifying original file however that is untenable (see below for explanation). Any ideas how to track the original file after pcap files merged?
why editcap solution won't work
I considered using editcap to add per-packet comments on every packet before merging (How to add a comment to all packets in numerous pcap files before merging into a single file) however the problem with this approach is that editcap requires every packet comment to be individually specified on the command line (you can't specify a range of packets). Thats hundreds of thousands of comments and the command line won't support that. Additionally, if I try to run editpcap with just a few comments at a time over and over it rewrites the entire file every time, leading to thousands of file rewrites. Also not viable.
If your original capture files are in .pcapng format, then each one contains an Interface Description Block or IDB. When you run mergecap to merge them, you can specify that IDB's not be merged using the -I none option. In this way, the interface number will be unique per original file and you can add a column that shows that information to easily differentiate the source of each packet by interface ID, or you can apply a display filter to isolate only those packets from a particular capture file.
The filter or column to use would be the frame.interface_id field, but you could also filter by frame.interface_name or frame.interface_description if those field values all have different values too, but there's no guarantee those fields will be unique as the interface name and/or description might contain the same information, even if the capture files originate from different machines.

Importing data from postgres to cytoscape

I have been trying to load some gis data from a postgis database into Cytoscape 3.6. I am trying to get some inDegree and outDegree values I have used the sif file format.
As long as the data is written out in the follow format
source_point\tinteracts with\ttarget_point
Cytoscape is happy to read it.
I am just wondering if there is anyway of including my own metric for the cost of getting between source_point and target_point
Sure! There are several ways to read in text files into Cytoscape -- SIF is just one of them. I would create a file that looks like SIF, but is actually a more complete text file:
Source\tTarget\tScore
source_point\ttarget_point\t1.1
...
And then use the "File->Import Network->File", choose your source and target and leave score as an edge attribute. You can have as many attributes on each line as you want, and can even mix edge attributes, source node attributes, and target node attributes.
-- scooter

In DataStage, how do you extract an element together with a list of elements from an XML file

so I've spent hours trying to figure this out. I'm basically trying to read an xml document (using the Hierarchical Data stage). Then I need to output the contents of that document into a dataset with two columns.
The difficulty is that in the xml document I read from an element and then I need to read from a list of elements; Specifically productID and SubjectCode.
The output I need is this
But I'm getting the following error because DataStage doesn't want to associate a single element with a multiple list element .
I should mention that if subjectCode was a single element like productID, it works fine. Any ideas would be appreciated.
Apologies, I'm not at a computer to deliver screenshots but I recall having a similar issue and this answer is intended to give you some more options to try (if you haven't already done these!)
I believe you can set subjectCode as the "top" element and then the mapping for productID would become ../productID
Failing that, you can right click and set subjectCode element differently within the XML_Parser_step in order to create a repeater element there
I believe the Datastage XML Integration Redbook covers off the above and is available from the IBM for free

Deleting multiple labels in perforce

I am working on a perforce-perl script that creates labels. Due to repeated execution of the script i have created hundreds of labels of the type LABEL_A.180 etc.
I want to know if there is any command or any other way by which I can delete multiple labels at a time?
There is no command or feature in P4V to delete multiple labels. The best approach will be just write another script that finds the labels and then removes them one-by-one.
I do not know the P4Perl API so I'm unable to give you an example, however it will be very similar to existing label creation just with an additional -d flag passed to the p4 label command.
HTH,

Finding baselines associated with a CR in the Telelogic Synergy command line

How would one find baselines associated with a CR in Telelogic Synergy using the CLI interface? I have tried ccm query "cvtype='baseline' and cr('xxx')", but this doesn't produce any results.
From the GUI you can look at the properties of a baseline and see which CRs are associated with the baseline, but I can't seem to find the proper CLI magic to allow me to write a script to take a CR and list the baselines.
I think associations between a baseline and a CR are handled with relationships (ccm relate).
Search for "Predefined relationships" in the Synergy manual for a list of the existing relationship. When you know the name of the relationship you should then be able to use a query with the function has_relationship_name().
Change request is associated more with a RELEASE rather than a BASELINE. So the following query will help you get the RELEASE, you can further run another query to retrieve the baseline.
To retrieve the release for the
ccm.exe query -f "%release %modify_time %create_time" "cr('xxxxx')"
Once you retrieve the RELEASE and MODIFY_TIME, run a new query to get the BASELINES
ccm.exe query -f "%objectname %modify_time %create_time" "(cvtype='project') and (release='pppp/qqqq') and (modify_time>=time('1/30/13'))" -s integrate
This way you will get a narrower list of BASELINES you can work with, I know this may not be the answer you are looking for but it might help.