예제 #1
0
		# SVG coordinate system: upper left corner, right/down
		#
		# guides are an Inkscape extension and follow Inkscape's coordinate system:
		# lower left corner, right/up
		x         = float(image.getAttribute("x"))
		y         = float(image.getAttribute("y"))
		width     = float(image.getAttribute("width"))
		height    = float(image.getAttribute("height"))
	except (IndexError,AttributeError,TypeError):
		print("Could not retrieve important XML elements! Invalid Inkscape SVG file?")
		sys.exit(1)
	
	print("potential map image at x={0} y={1} w={2} h={3}".format(x,y,width,height))
	
	lon0 = OSMTools.x_to_lon(args.X0,args.ZOOM)
	lat0 = OSMTools.y_to_lat(args.Y0,args.ZOOM)
	lon1 = OSMTools.x_to_lon(args.X0+args.NX,args.ZOOM)
	lat1 = OSMTools.y_to_lat(args.Y0+args.NY,args.ZOOM)
	
	#
	# prepare lists of meridians and parallels
	#
	
	stepsize = 1/args.steps
	special_meridians = (OSMTools.PRIME_MERIDIAN,)
	special_parallels = (OSMTools.ARCTIC_CIRCLE,OSMTools.TROPIC_CANCER,OSMTools.EQUATOR,OSMTools.TROPIC_CAPRICORN,OSMTools.ANTARCTIC_CIRCLE)
	
	# build meridians list; depends on map boundaries, stepsize and (optional) special meridians
	meridians = list()
	med = math.ceil(lon0*args.steps)/args.steps # round to nearest fraction inside map (round up)
	medend = math.floor(lon1*args.steps)/args.steps # round to nearest fraction inside map (round down)
예제 #2
0
Tiles (x,y)
   upper left tile    {8},{9}
   lower right tile   {10},{11}
   number of tiles    {12}x{13}

Resolution/Map Scale
{15}

addGrid Parameters
   {1} {8} {9} {12} {13}
----- End Map Image Information -----
""".format(
		args.FILE,
		args.ZOOM,
		w,h,
		OSMTools.x_to_lon(x0,args.ZOOM),OSMTools.y_to_lat(y0,args.ZOOM),
		OSMTools.x_to_lon(x1,args.ZOOM),OSMTools.y_to_lat(y1,args.ZOOM),
		x0,y0,
		x1-1,y1-1,
		x1-x0,y1-y0,
		" ".join(sys.argv[1:]),
		resolution
	)
	
	print(mapinfo)
	if args.infofile != None:
		# user requested info should be written to file
		with open(args.infofile,"w") as f:
			f.write(mapinfo)