Exemplo n.º 1
0
    def test_convert_002(self):
        # <node id="583525261" version="6" timestamp="2018-09-20T08:38:47Z" uid="8354582" user="******" changeset="62755031" lat="44.0472726" lon="15.3004193">

        x, y = deg2num(44.0472726, 15.3004193, 9)

        map = num2MapBB(x, y, 9, conversion_type.normal)
        print("bb_norm z=9 {}".format(map.getinfo()))
        print("bb {}".format(map.geojson()))
        print("bb x={},y={},z={}".format(x, y, 9))
Exemplo n.º 2
0
 def test_convert_ext_z12(self):
     # sample: 2176-1315-12.osm
     # <bounds minlat='53.90433816' minlon='11.16210938' maxlat='54.05938789' maxlon='11.42578125'/>
     tilemap = num2MapBB(2176, 1315, 12, conversion_type.extendet)
     print("bb_ext  z=12 {}".format(tilemap.getinfo()))
     self.assertAlmostEqual(tilemap.minlat, 53.90433816)
     self.assertAlmostEqual(tilemap.minlon, 11.16210938)
     self.assertAlmostEqual(tilemap.maxlat, 54.05938789)
     self.assertAlmostEqual(tilemap.maxlon, 11.42578125)
Exemplo n.º 3
0
 def test_convert_ext_z11(self):
     # sample: 1089-657-11.osm
     # <bounds minlat='53.85252660' minlon='11.25000000' maxlat='54.16243397' maxlon='11.77734375'/>
     tilemap = num2MapBB(1089, 657, 11, conversion_type.extendet)
     print("bb_ext  z=12 {}".format(tilemap.getinfo()))
     self.assertAlmostEqual(tilemap.minlat, 53.85252660)
     self.assertAlmostEqual(tilemap.minlon, 11.25000000)
     self.assertAlmostEqual(tilemap.maxlat, 54.16243397)
     self.assertAlmostEqual(tilemap.maxlon, 11.77734375)
Exemplo n.º 4
0
 def test_convert_ext_z9(self):
     # sample 272-164-9.osm
     # <bounds minlat='53.64463782' minlon='11.07421875' maxlat='54.26522408' maxlon='12.12890625'/>
     tilemap = num2MapBB(272, 164, 9, conversion_type.extendet)
     print("bb_ext  z=9 {}".format(tilemap.getinfo()))
     self.assertAlmostEqual(tilemap.minlat, 53.64463782)
     self.assertAlmostEqual(tilemap.minlon, 11.07421875)
     self.assertAlmostEqual(tilemap.maxlat, 54.26522408)
     self.assertAlmostEqual(tilemap.maxlon, 12.12890625)
Exemplo n.º 5
0
    def test_convert_ext_z10(self):
        # sample: 544-328-10.osm
        # <bounds minlat='53.85252660' minlon='11.07421875' maxlat='54.26522408' maxlon='11.77734375'/>

        tilemap = num2MapBB(544, 328, 10, conversion_type.extendet)
        print("bb_ext  z=12 {}".format(tilemap.getinfo()))
        self.assertAlmostEqual(tilemap.minlat, 53.85252660)
        self.assertAlmostEqual(tilemap.minlon, 11.07421875)
        self.assertAlmostEqual(tilemap.maxlat, 54.26522408)
        self.assertAlmostEqual(tilemap.maxlon, 11.77734375)
Exemplo n.º 6
0
    parser.add_argument('-z',
                        dest='z',
                        default="9",
                        help='tile z')
    
    args = parser.parse_args()
    
    
    x=int(args.x)
    y=int(args.y)
    z=int(args.z)
    
    
    
    bb = num2MapBB(x, y, z, conversion_type.extendet)
    
    link = "http://map.openseamap.org/"
    link +="?zoom={}".format(z)
    link += "&lat={}&lon={}".format(bb.lat, bb.lon)
    link += "&mlat={}&mlon={}".format(bb.lat, bb.lon)
    link += "&mtext=x{}_y{}_z{}".format(x,y,z)
    link += "&layers=BFTFFFFFFTF0FFFFFFFFFF"
    print(link)
    
    print("\n\nquery for https://overpass-turbo.eu/")
    print(bb.GetOverpassQuery())
    
    print("\n\ngeojson info:")
    print(bb.geojson()())
    
Exemplo n.º 7
0
    print("generate config file for command \"osmium extract\": {}".format(
        in_filename))
    print("input file: {}".format(in_filename))
    print("output dir: {}".format(args.outdir))
    print("x_min={}, x_max={}, y_min={}, y_max={}, z={}".format(
        x_min_z9, x_max_z9, y_min_z9, y_max_z9, z))

    # stage 1 / generate config file with level 9
    maplist = list()

    for y_z9 in range(y_min_z9, y_max_z9 + 1):
        for x_z9 in range(x_min_z9, x_max_z9 + 1):
            maplist.append([
                x_z9, y_z9, z,
                num2MapBB(x_z9, y_z9, z, conversion_type.extendet)
            ])

    confdir = args.outdir + "cfg/"
    ensure_dir(confdir)
    outfile = confdir + "osmium_extract_z9.cfg"

    if os.path.exists(outfile):
        os.remove(outfile)

    osmdir = args.outdir + "osm-extracts/"
    ensure_dir(osmdir)

    write_configfile(outfile, osmdir, maplist)
    convert_cmd = "osmium extract --overwrite --config {} {}".format(
        outfile, in_filename)
Exemplo n.º 8
0
 def test_convert_002(self):
     tilemap = num2MapBB(272, 164, 9, conversion_type.normal)
     print("bb_norm z=9 {}".format(tilemap.getinfo()))
Exemplo n.º 9
0
 def test_convert_ext_z9_max(self):
     tilemap = num2MapBB(511, 511, 9, conversion_type.extendet)
     print("bb_ext  z=9 {}".format(tilemap.getinfo()))
     #self.assertAlmostEqual(tilemap.minlat, -90)
     self.assertAlmostEqual(tilemap.maxlon, 180)