Сountry names are not displayed on the map - gis

I`m trying to create map which has several layers. One of them consist of country borders (admin_level = 2,3), country name and region names. I use data of coordinates of Armenia and China from https://download.geofabrik.de/asia.html. I succesfully consolidated these countries with Osmosis 0.40.1.:
osmosis --read-pbf armenia-latest.osm.pbf --read-pbf china-latest.osm.pbf --merge --write-pbf ArChina.osm.pbf
And extracted border with admin_level = 2,3:
osmosis --read-pbf ArChina.osm.pbf --tf accept-relation boundary=administrative admin_level=2,3 --tf reject-ways admin_level=5,6,7,8,9 --used-way idTrackerType=Dynamic --tf reject-nodes admin_level=4,5,6,7,8,9 --tf reject-nodes place=village,town,suburb,city --used-node idTrackerType=Dynamic --write-xml ArChinaBord1.osm
Then I converted it to .osm.pbf with Osmosis.
I understand that I didn't remove all the nodes such as bus stops, natural objects, etc. That`s not the problem.
The problem is - when I`ve launched this map on Ubuntu server - I saw the borders of 2 countries, region names of both of them and only 1 country name (Armenia). I was trying to zoom in and zoom out, but it didn't help. Сhina name is not showing at all.
I checked ArChinaBord1.osm (consolidated file with Armenia and China borders, names). The xml structure of Armenia and China names (node with place=country) is the same, but only one name is shown.
Could you give me some advice, how it could be fixed?

Related

Does this text-based file format similar to csv/tsv that seems to contain multiple sheets have a name?

I have a text-based file format that is similar to csv/tsv with separators that are pipes |, and the first column of each row seems to be the "sheet/table" name, but there are no headers.
See the example below...I'd like to put a name to it so that I can import it into a tool and work with the data.
TABLEORSHEET1|Lar|Lafard|113 North Dakota Ln.|Johnstown|PA|15905
TABLEORSHEET1|Nancy|Lafard|114 North Dakota Ln.|Johnstown|PA|15905
TABLEORSHEET1|Tommy|Lafard|115 North Dakota Ln.|Johnstown|PA|15905
TABLEORSHEET2|1|Tea Cup|1.42|0
TABLEORSHEET2|1|Coffee Cup|3.42|1
TABLEORSHEET3|1|EDIT|LNAME|Laffer|Lafard
TABLEORSHEET3|1|EDIT|FNAME|Larry|Lar
I've seen this file format used twice before and both were either an import or an export to/from an Oracle system.

LMDB: How to interpret output from mdb_stat and mdb_dump utilities

I have a functional LMDB that, for test purposes, currently contains only 21 key / value records. I've successfully tested inserting and reading records, and I'm comfortable with the database working as intended.
However, when I use the mdb_stat and mdb_dump utilities, I see the following output, respectively:
Status of Main DB
Tree depth: 1
Branch pages: 0
Leaf pages: 1
Overflow pages: 0
Entries: 1
VERSION=3
format=bytevalue
type=btree
mapsize=1073741824
maxreaders=126
db_pagesize=4096
HEADER=END
4d65737361676573
000000000000010000000000000000000100000000000000d81e0000000000001500000000000000ba1d000000000000
DATA=END
In particular, why would mdb_stat indicate only one entry when I have 21? Moreover, each entry comprises 1024 x 300 values of five bytes per value. mdb_dump obviously doesn't show anywhere near the 1,536,000 bytes I'd expect to see, yet the values I mdb_put() and mdb_get() on the fly are correct. Anyone know what's going on?
The relationship between an operating system's directory and an LMDB environment's data.mdb and lock.mdb files is one-to-one.
If the LMDB environment (in the OS directory) has more than one database, then the environment also contains a separate LMDB database containing all of its named databases.
The mdb_stat and mdb_dump utilities appear to contain minimal logic, so when they are fed a given directory via the command line, they appear to produce results only for the database storing database names and not the database(s) storing the actual data of interest.
4d65737361676573 is the Ascii for "Messages", which is the name of table ("sub-db" in lmdb terminology) storing the actual data in your case.
The mdb_dump command only dumps the main db by default. You can use the -s option to dump that sub-db, i.e.
mdb_dump -s Messages
or you can use the -a option to dump all the sub-dbs.
Since you are using a sub-database, the number of entries in the main database corresponds to the number of sub-databases you've created (ie just 1).
Try using mdb_stat -a. This will show you a break-down of all the sub-databases (as well as the main DB). In this breakdown it will list the number of entries for each sub-database. Here you should see your 21 entries.

How can I remove water from OpenStreetMap ways?

I'd like to get the outline of San Francisco from OpenStreetMap. There's a relation for SF, but it includes large amounts of water which would make it unrecognizable to a resident of the city:
Is there a better polygon for San Francisco in OSM? Are there ways for the coastlines and, if so, how might I find them and subtract them from the administrative boundary?
I was able to do this using osmtogeojson and ogr2ogr. First I grabbed the full OSM XML for the San Francisco relation and converted it to GeoJSON:
$ curl 'http://www.openstreetmap.org/api/0.6/relation/111968/full' > sf.osm
$ osmtogeojson sf.osm > sf.json
Then I removed the non-polygon features using this script:
$ only_polygons.py sf.json > sf.polygons.json
Then I downloaded the land polygons file that Tordanik referenced and ran:
$ ogr2ogr land_polygons.sfbbox.shp -clipsrc -122.56 37.68 -122.27 37.939 land-polygons-complete-4326/land_polygons.shp
$ ogr2ogr -f GeoJSON sf-land.json -clipsrc sf.polygons.json land_polygons.sfbbox.shp
This produces a GeoJSON file (sf-land.json) with the land boundaries of San Francisco:
I'm not sure where the Farallon Islands went, but this basically seems to work!
Every step of this is fast except for the first ogr2ogr command, which clips the land polygons to a bounding box containing San Francisco. This took ~2 minutes on my MacBook Pro. This way was dramatically fast than passing sf.polygons.json directly as the -clipsrc argument to the first command.
Yes, there are ways for the coastline. For example this way which is also part of the relation but also this way which is obviously not part of the relation. Therefore I think it is very challenging to mechanically remove all water and smaller islands but not impossible. I guess you would have to retrieve all map data inside the polygon and run some spatial queries.
The relation you are looking at defines the administrative border of San Francisco. The relation you are looking for would be San Fransisco's landmass without the water (and probably without the smaller islands belonging to San Francisco). Such relations usually don't exist in OSM.

Parsing csv file with vim

I have a large CSV file structured as follows:
CHINESE TRANSLATION
我去上学。 Wǒ qù shàngxué. I am going to school. 上 ♦ on, on top of ♦ go to
我去过北京。 Wǒ qùguò Běijīng. I've been to Beijing. 京 -- ♦ national capital ♦ Beijing
....
The TRANSLATION column blends together three different informations: the pinyin, the English translation and additional information. These three types of information are always present and always presented in the same way and separated by a dot.
What I want to achieve is to create three different columns from the TRANSLATION column, ie to get :
CHINESE PINYIN TRANSLATION ADDITIONAL
我去上学。 Wǒ qù shàngxué. I am going to school. 上 ♦ on, on top of ♦ go to
....
Using a vim macro, how can I do this ?
I think vim macros can handle this job, but executing a vim macro on a big file several thousand times is very slow. So if you just want your job done, I have just wrote a python script, and I think it could give you what you want.
import csv
# change 'in.csv' and 'out.csv'
# to your exact file names.
with open('in.csv', 'r') as infile:
with open('out.csv', 'w') as outfile:
csvreader = csv.reader(infile)
for a, b in csvreader:
line = a + ',' + ','.join(b.split('.'))
outfile.writelines(line)

Filter OSM with osmosis for specific amenity

I have downloaded the Ireland file from cloudmade for osmosis (500 MB) and placed it in the osmosis bin folder, which osmosis reads fine. I would now like to create a new file with just those places tagged with Tag:amenity=fast food. My directory is:
C:\Program Files (x86)\osmosis-0.41\bin>
I'm currently following the tag-filter guide on the OSM wiki but can't get it to work. Here's what I'm trying:
C:\Program Files (x86)\osmosis-0.41\bin>osmosis --read-xml ireland.osm
--tf accept-nodes amenity=fast food --write-xml output.osm
And here's the error I get:
org.openstreetmap.osmosois.core.Osmosis main
SEVERE: Execution aborted.
org.openstreetmap.osmosis.core.OsmosisRuntimeException:
Only one default (un-named) argument can exist per task.
Arguments 6 and 4 have no name.....
Can you tell me what I'm doing wrong? Thanks.
you should put your filter value among "-s, like this: amenity="fast food"
you need to put "" and ',' on amenity=fast food.
it should be amenity="fast,food"
Had the same error. In my case, the command was split over several lines using \:
osmosis \
--read-xml ireland.osm \
--tf accept-nodes amenity="fast food" \
--write-xml output.osm
The reason of the error was that there was a space after one of the backslashes.